Cod sursa(job #546290)
Utilizator | Data | 4 martie 2011 18:53:26 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 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;
for(x=0; 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;
}