Cod sursa(job #871858)
Utilizator | Data | 5 februarie 2013 13:49:17 | |
---|---|---|---|
Problema | Factorial | Scor | 35 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.47 kb |
#include <iostream>
#include <fstream>
using namespace std;
int x,s=0,p;
long long n=5;
int main()
{
ifstream f("fact.in");
ofstream g("fact.out");
f>>p;
if(p==0)
g<<1;
else
{
while(s<p)
{
x=n;
while(x%10%5==0)
{
s++;
x/=5;
}
n=n+5;
}
if(s==p)
{
n=n-5;
g<<n;
}
else g<<-1;
}
return 0;
}