Cod sursa(job #1221956)
Utilizator | Data | 21 august 2014 18:47:55 | |
---|---|---|---|
Problema | Factorial | Scor | 15 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.55 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int main()
{
int p; f>>p;
int x;
int nr=0, k=0;
x=p;
if(p==0)
g<<"1";
else
{ if(x%5==0)
{
do
{
x=x/5;
} while(x%5==0);
g<<"-1";
}
else{
while(k!=p)
{
k++;
nr=nr+5;
} g<<nr;
}
}
return 0;
}