Cod sursa(job #541237)
| Utilizator | Data | 24 februarie 2011 22:05:22 | |
|---|---|---|---|
| Problema | Factorial | Scor | 45 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.58 kb |
#include <fstream>
using namespace std;
inline unsigned long long int find_five(long p) {
long i=0,zero=0,j;
short cont;
while(p>0) {
cont=1;
i+=5;
j=i/5;
verifica:
if(j%5==0) {
cont++;
j/=5;
goto verifica;
}
p-=cont;
zero+=cont;
}
return i;
}
int main() {
long p;
ifstream f("fact.in");
f>>p;
f.close();
ofstream g("fact.out");
g<<find_five(p);
g.close();
return 0;
}
