Cod sursa(job #546281)
Utilizator | Data | 4 martie 2011 18:48:42 | |
---|---|---|---|
Problema | Factorial | Scor | 25 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.4 kb |
#include<fstream>
using namespace std;
int main()
{
long long P,x,a=0,cx;
ifstream fin("fact.in");
ofstream fout("fact.out");
fin>>P;
if(P==0)
fout<<1;
else
{
for(x=5; x<=100000000; x=x+5)
{
cx=x;
while(cx%5==0)
{
a++;
cx/=5;
}
if(a>=P)
break;
}
if(a==P)
fout<<x;
else
fout<<-1;
}
fin.close();
fout.close();
return 0;
}