Cod sursa(job #1075557)
Utilizator | Data | 9 ianuarie 2014 10:25:13 | |
---|---|---|---|
Problema | Factorial | Scor | 15 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.37 kb |
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int nrz(int x){
int s=0;
while(x>0){
s=s+x/5;
x=x/5;
}
return s;
}
int main()
{
int 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;
}