Cod sursa(job #323624)
| Utilizator | Data | 12 iunie 2009 21:31:52 | |
|---|---|---|---|
| Problema | Factorial | Scor | 50 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.67 kb |
#include <fstream>
#include <iostream>
using namespace std;
fstream f,g;
long p;
long x;
long d,c;
int main()
{
f.open("fact.in",fstream::in);
f >> p;
g.open("fact.out",fstream::out);
if(p==0)
{
g << "1\n";
g.close();
return 0;
}
long y,i,aux;
y=0;
for(i=5;;i+=5)
{
aux = i;
while(aux%5==0)
{
aux/=5;
y++;
}
if(y == p)
{
g << i << "\n";
g.close();
return 0;
}
if(y>p)
break;
}
g << "-1\n";
g.close();
return 0;
}
