Cod sursa(job #2118009)
| Utilizator | Data | 29 ianuarie 2018 21:47:21 | |
|---|---|---|---|
| Problema | Factorial | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.43 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int main(){
long long int rez, n, check = 1;
fin >> n;
long long int num = n;
rez = num/5;
num = rez;
while(num > 0){
if(check > 0){
rez = rez + (num / 5);
//check = -1;
} else {
rez = rez - (num / 5);
check = 1;
}
num = num / 5;
}
fout << rez << "\n";
return 0;
}
