Cod sursa(job #2203995)
Utilizator | Data | 13 mai 2018 23:09:58 | |
---|---|---|---|
Problema | Factorial | Scor | 50 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.47 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int p, n=5, ct=1, x;
ifstream f("fact.in");
ofstream g("fact.out");
f>>p;
if(p==0)
{
g<<1;
return 0;
}
while(ct<p)
{
n+=5;
x=n;
while(x%5==0)
{
ct++;
x/=5;
}
}
if(ct==p)
g<<n;
else
g<<-1;
f.close();
g.close();
return 0;
}