Cod sursa(job #1482447)
Utilizator | Data | 7 septembrie 2015 10:51:39 | |
---|---|---|---|
Problema | Factorial | Scor | 45 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <fstream>
using namespace std;
int k,p,i,x,a;
int main()
{
ifstream f("fact.in");
ofstream g("fact.out");
f>>p;
i=0;
while(k<p)
{
i=i+5;
x=i;
k++;
while((x/5)%5==0)
{
x=x/5;
k++;
}
}
if(p==0) g<<1;
if(k==p)
g<<i;
else g<<-1;
return 0;
}