Cod sursa(job #1487667)
Utilizator | Data | 17 septembrie 2015 10:50:13 | |
---|---|---|---|
Problema | Factorial | Scor | 45 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.4 kb |
#include <fstream>
using namespace std;
int y,p,i,x,a;
int main()
{
ifstream fin("fact.in");
ofstream fout("fact.out");
fin>>p;
i=0;
while(y<p)
{
i=i+5;
x=i;
y++;
while((x/5)%5==0)
{
x=x/5;
y++;
}
}
if(p==0) fout<<1;
if(y==p)
fout<<i;
else fout<<-1;
return 0;
}