Cod sursa(job #1448243)
Utilizator | Data | 6 iunie 2015 14:56:33 | |
---|---|---|---|
Problema | Factorial | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.34 kb |
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int p,aux,x;
int main()
{
f>>p; x=5;
if(p==0) g<<1;
else
{while(p>0)
{
aux=x;
while(aux%5==0) {aux/=5; p--;}
x+=5;
}
if(p==0) g<<x-5;
else g<<-1;}
g.close();
return 0;
}