Cod sursa(job #545960)
Utilizator | Data | 4 martie 2011 10:20:43 | |
---|---|---|---|
Problema | Factorial | Scor | 35 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.41 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)
//for(i=1;ok==0;i++)
{
int aux=i;
while(aux%5==0)
if (aux%5==0)
{
l++;
aux/=5;
}
if (l>=p) ok=1;
else i++;
}
if(l!=p) g<<-1;
else g<<i;
f.close();
g.close();
return 0;
}