Pagini recente » tema | Cod sursa (job #808014) | Cod sursa (job #2607927) | Cod sursa (job #1897361) | Cod sursa (job #2545124)
#include <iostream>
#include<fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int yeet(int x){
int ynot=0,yes=5;
while(yes<=x){
ynot+=x/yes;
yes*=5;
}
return ynot;
}
int main()
{
int N,P,st=0,dr=10000005,no_u=-1,check_mid;
fin>>P;
while(st<=dr){
check_mid=(st+dr)/2;
if(yeet(check_mid)==P)
no_u=check_mid;
if(yeet(check_mid)>=P)
dr--;
else
st++;
}
if(no_u==0)
fout<<1;
else
fout<<no_u;
return 0;
}