Cod sursa(job #2588357)
Utilizator | Data | 24 martie 2020 18:09:37 | |
---|---|---|---|
Problema | Factorial | Scor | 25 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.57 kb |
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int main()
{
int P,N=0,aux,doi=0,cinci=0;
f>>P;
f.close();
while(doi<P||cinci<P)
{
N++;
aux=N;
while(aux%2==0)
{
doi++;
aux/=2;
}
while(aux%5==0)
{
cinci++;
aux/=5;
}
if(doi>P&&cinci>P)
{
N=-1;
break;
}
}
if(P==0) g<<1;
else
g<<N;
g.close();
return 0;
}