Cod sursa(job #1474855)
Utilizator | Data | 23 august 2015 02:31:44 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.44 kb |
#include <fstream>
using namespace std;
unsigned zerouri(unsigned x)
{int z;
while(x)
z=z+x/5;
x=x/5;
return z;
}
int main()
{ int st=1,dr=100000000,mijl;
unsigned N,P;
ifstream f("fact.in");
ofstream g("fact.out");
f>>P;
while(st<dr){
mijl=(st+dr)/2;
if(zerouri(mijl)<P)
st=mijl;
else
dr=mijl;
} g<<mijl;
return 0;
}