Cod sursa(job #904878)
Utilizator | Data | 4 martie 2013 22:19:49 | |
---|---|---|---|
Problema | Factorial | Scor | 25 |
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=4;
if(p==0) g<<1;
else if(p==5) g<<-1;
else{while(l!=0) {n++;
m=n;
while(m%5==0) {l--;
m=m/5; } }
g<<n;
}
return 0;
}