Cod sursa(job #868494)
Utilizator | Data | 31 ianuarie 2013 09:35:11 | |
---|---|---|---|
Problema | Factorial | Scor | 25 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.45 kb |
#include <iostream>
#include <fstream>
using namespace std;
long x,n=1,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++;
}
if(s==p)
{
n--;
g<<n;
}
else g<<-1;
}
return 0;
}