Cod sursa(job #175252)
| Utilizator | Data | 9 aprilie 2008 19:22:42 | |
|---|---|---|---|
| Problema | Factorial | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.42 kb |
#include <fstream.h>
#include <iostream.h>
#include <math.h>
int main()
{
long long int p,crt,zerouri=0,i,k;
fstream f,g;
f.open("fact.in",ios::in);
f>>p;
f.close();
g.open("fact.out",ios::out);
crt=2000;
while(zerouri>=p)
{ zerouri=0;
k=1;
while(crt>pow(5,k))
{
zerouri+=(crt/(pow(5,k)));
k++;
}
crt-=5;
}
if(zerouri==p)
g<<crt+5;
else
g<<-1;
g.close();
return 0;}
