Cod sursa(job #312150)
| Utilizator | Data | 5 mai 2009 11:01:36 | |
|---|---|---|---|
| Problema | Jocul Flip | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.56 kb |
#include<fstream.h>
fstream f("fact.in",ios::in);
fstream g("fact.out",ios::out);
void main(){
unsigned long p,n,n2,n5;
f>>p;
n2=0;
n5=0;
int gasit,exista;
unsigned long c=1,aux;
gasit=0;
while(gasit==0)
{ c++;
aux=c;
while(aux%2==0)
{
n2++;
aux/=2;
}
while(aux%5==0)
{
n5++;
aux/=5;
}
if(n2>p&&n5>p)
{exista=0;
gasit=1;
}
else
if(n2==p&&n5>p || n2>p&&n5==p)
{
gasit=1;
} exista=1;
}
if(exista)
g<<c;
else
g<<-1;
g.close();
}