Cod sursa(job #1700498)
Utilizator | Data | 10 mai 2016 17:17:41 | |
---|---|---|---|
Problema | Factorial | Scor | 35 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.41 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;
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;
}