Cod sursa(job #2233267)
Utilizator | Data | 22 august 2018 19:11:48 | |
---|---|---|---|
Problema | Factorial | Scor | 25 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <fstream>
using namespace std;
int main()
{ ifstream fin("fact.in");
ofstream fout("fact.out");
long long p, n, zero, a;
fin>> p;
if (p==0) fout << 1;
else {
n=5; zero=1;
while (zero<p)
{
n+=5; a=n;
while (a%5==0) { ++zero; a/=5; }
}
if (zero==p) fout << n;
else fout << -1;
}
return 0;
}