Cod sursa(job #175253)
Utilizator | Flavius Anton f.v.anton | Data | 9 aprilie 2008 19:27:17 |
---|---|---|---|
Problema | Factorial | Scor | 5 |
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=0;
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;}