Cod sursa(job #2164892)
Utilizator | Data | 13 martie 2018 10:19:31 | |
---|---|---|---|
Problema | Factorial | Scor | 20 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.41 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int main()
{
long long p, n, x, a;
f>>p;
n=5; x=0;
if (p == 0) g<<1;
else {
while (x<p)
{
a=n;
while (a/5 && a%5==0) { x++; a/=5; }
if (x!=p) n=n+5;
}
if (x==p) g<<n;
else g<<-1;
}
return 0;
}