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