Cod sursa(job #13436)
Utilizator | Data | 6 februarie 2007 17:54:20 | |
---|---|---|---|
Problema | Factorial | Scor | 20 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.43 kb |
#include<fstream>
using namespace std;
int n,p,m,q;
int main()
{
ifstream in("fact.in");
in>>p;
n=5;
q=p;
q--;
while(q)
{
n=n+5;
m=n;
while(m%5==0)
{
q--;
m=m/5;
}
}
ofstream out("fact.out");
if (p==0)
out<<1;
else
out<<n;
return 0;
}