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