Cod sursa(job #1114260)
Utilizator | Data | 21 februarie 2014 14:08:32 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.56 kb |
#include <fstream>
#include <climits>
using namespace std;
int zero(int n)
{
int x;
int k=0,y;
for(x=5;x<=n;x=x++)
{
y=x;
while(y%5==0)
{
k++;
y=y/5;
}
}
return k;
}
int main()
{
ifstream f("fact.in");
ofstream g("fact.out");
int N,P,ok;
f>>P;
N=1;
ok=0;
while(N<INT_MAX)
{
if(zero(N)==P)
{
ok=1;
g<<N;
break;
}
N++;
}
if(ok==0)
g<<-1;
return 0;
}