Cod sursa(job #1060550)
Utilizator | Data | 18 decembrie 2013 08:15:52 | |
---|---|---|---|
Problema | Factorial | Scor | 15 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.33 kb |
#include <fstream>
using namespace std;
int main()
{
ifstream f("fact.in");
long long n=0,i=0,p,y=2;;
ofstream g("fact.out");
f>>p;
while(n<p)
{
y=i=i+5;
while(y%5==0){n++;y=y/5;}
if(i>=100000000){i=-1;break;}
}
g<<i;
f.close();
f.close();
return 0;
}