Cod sursa(job #904880)
Utilizator | Data | 4 martie 2013 22:23:03 | |
---|---|---|---|
Problema | Factorial | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.37 kb |
#include <fstream>
using namespace std;
int main()
{ int n,l,m,p;
ifstream f("fact.in");
ofstream g("fact.out");
f>>p;
l=p;
n=0;
if(p==0) g<<1;
else if(p==5) g<<-1;
else{while(l!=0) {n=n+5;
m=n;
while(m%5==0) {l--;
m=m/5; } }
g<<n;
}
return 0;
}