Cod sursa(job #404193)
Utilizator | Data | 25 februarie 2010 21:18:46 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.3 kb |
#include<fstream.h>
ifstream f("fact.in");
ofstream g("fact.out");
long n,p,q;
int gasit,s;
int main()
{
f>>p;
q=pow(10,p);
s=1;
n=0;
gasit=0;
while ( !gasit )
{ n++;
s=s*n;
if ( s%q==0 )
{ g<<n-1;
gasit=1;}
}
f.close();
g.close();
return 0;
}