Cod sursa(job #1781317)
Utilizator | Data | 16 octombrie 2016 20:00:01 | |
---|---|---|---|
Problema | Factorial | Scor | 15 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int main(){
long long int N;
long long d=2,c=5;
f>>N;
d*=N,c*=N;
long long int l=1;
if(N==0)g<<1;
else{
while(d || c){
long long x=l;
while(!(x%2) && d)d-=2,x/=2;
while(!(x%5) && c)c-=5,x/=5;
l++;
}
g<<l-1;
}
}