Cod sursa(job #915969)
Utilizator | Data | 15 martie 2013 17:09:44 | |
---|---|---|---|
Problema | Factorial | Scor | 45 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.32 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int x=0,p,cx;
int main()
{
f>>p;
while (p>0)
{
x+=5;cx=x;
while (cx%5==0){p--;cx/=5;}
}
if (p==0)g<<x;
else g<<"-1";
f.close();
g.close();
return 0;
}