Cod sursa(job #358000)
Utilizator | Data | 21 octombrie 2009 17:25:02 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.29 kb |
#include<fstream.h>
#include<math.h>
int main()
{
int p,n,b,k,x;
ifstream f("fact.in");
ofstream g("fact.out");
f>>p;
k=0;
n=0;b=1;
while(k<p-1)
{
n+=5; k++;
x=pow(5,b);
if(k%x==0){k+=b-1;b++;}
}
g<<n;
f.close();
g.close();
return 0;
}