Cod sursa(job #903948)
Utilizator | Data | 3 martie 2013 14:41:59 | |
---|---|---|---|
Problema | Factorial | Scor | 15 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.32 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
long long b,c,a,m,P,i;
int main()
{ f>>P;
if (P==0) g<<1;
else {
for (i=1;c!=P;i++) {m=i;
while (m%2==0) {a++;m=m/2;}
while (m%5==0) {b++;m=m/5;}
while (a&&b) {a--;b--;c++;}
}}
g << i-1;
return 0;
}