Cod sursa(job #2548957)
Utilizator | Data | 17 februarie 2020 10:40:03 | |
---|---|---|---|
Problema | Factorial | Scor | 35 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int main()
{
int p, nrz, x, y;
fin>>p;
nrz=0;
x=5;
while(nrz<p)
{
y=x;
while(y%5==0)
{
nrz++;
y=y/5;
}
x=x+5;
}
if(nrz>p)
fout<<"-1";
else
fout<<x-5;
}