Cod sursa(job #545963)
Utilizator | Data | 4 martie 2011 10:21:33 | |
---|---|---|---|
Problema | Factorial | Scor | 25 |
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;
while(!ok)
{
int aux=i;
while(aux%5==0)
if (aux%5==0)
{
l++;
aux/=5;
}
if (l>=p) ok=1;
else i++;
}
if(ok) g<<i;
else g<<-1;
f.close();
g.close();
return 0;
}