Cod sursa(job #20861)
Utilizator | Data | 22 februarie 2007 15:41:41 | |
---|---|---|---|
Problema | Factorial | Scor | 35 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.29 kb |
#include<iostream.h>
#include<fstream.h>
#include<string.h>
int main()
{
ifstream f("fact.in");
ofstream g("fact.out");
unsigned long p,x,n;
f>>p;
n=5;
p--;
while(p)
{x=n;
while(x%5==0) {x/=5;p--;}
n+=5;
}
g<<n;
f.close();
g.close();
return 0;
}