Cod sursa(job #630913)
Utilizator | Data | 6 noiembrie 2011 18:57:44 | |
---|---|---|---|
Problema | Factorial | Scor | 35 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include<fstream>
using namespace std;
int main()
{
long x,i,cont,aux;
ifstream f("fact.in");
ofstream g("fact.out");
f>>x;
cont=0;
i=5;
while(cont<x)
{
aux=i;
while(aux%5==0)
{
cont++;
aux=aux/5;
}
i+=5;
}
i-=5;
if(x==0)
g<<1;
else
if(cont==x)
g<<i;
else
g<<-1;
return 0;
}