Cod sursa(job #868499)
Utilizator | Data | 31 ianuarie 2013 09:49:41 | |
---|---|---|---|
Problema | Factorial | Scor | 35 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
#include <iostream>
#include <fstream>
using namespace std;
int x,n=5,p,s=0;
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;
}