Cod sursa(job #545959)
Utilizator | Data | 4 martie 2011 10:19:04 | |
---|---|---|---|
Problema | Factorial | Scor | 35 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include<iostream.h>
#include<fstream.h>
int main()
{
ifstream f;
f.open("fact.in");
ofstream g;
g.open("fact.out");
int p, l=0, i=1;
f>>p;
int ok=0;
for(i=1;ok==0;i++)
{
int aux=i;
while(aux%5==0)
if (aux%5==0)
{
l++;
aux/=5;
}
if (l>=p) ok=i;
}
if(l!=p) g<<-1;
else g<<ok;
f.close();
g.close();
return 0;
}