Pagini recente » Diferente pentru problema/kfib intre reviziile 49 si 48 | Cod sursa (job #1775096) | Cod sursa (job #502961) | Cod sursa (job #1208530) | Cod sursa (job #502942)
Cod sursa(job #502942)
#include <fstream>
#define nmax 500000
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int p, answer;
int nr_zero(int x)
{
int s=0;
s=x/5;
return s;
}
int caut_binar()
{
int left=0; int right=nmax, m;
while(1)
{
m=(left+right)/2;
if(nr_zero(m)>p) right=m-1;
else if(nr_zero(m)<p) left=m+1;
else break;
}
return m;
}
int main()
{
f>>p;
answer=caut_binar();
g<<answer;
return 0;
}