Cod sursa(job #1075558)
Utilizator | Data | 9 ianuarie 2014 10:26:28 | |
---|---|---|---|
Problema | Factorial | Scor | 15 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.4 kb |
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
long long nrz(long long x){
long long s=0;
while(x>0){
s=s+x/5;
x=x/5;
}
return s;
}
int main()
{
long long i=0,pas=1<<16,n;
f>>n;
while(pas!=0){
if(nrz(i+pas)<=n-1)
i+=pas;
pas/=2;
}
g<<i+1;
return 0;
}