Cod sursa(job #2758281)
Utilizator | Data | 9 iunie 2021 15:34:39 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.41 kb |
#include <fstream>
using namespace std;
ifstream cin("taxe.in");
ofstream cout("taxe.out");
static int bruh(int x){
int sum=0;
while(x>0) {
sum+=x*4;
x/=4;
}
return sum;
}
int main()
{
int n,st,dr,mid;
cin>>n;
st=0;
dr=n;
while(dr>st+1)
{
mid=(st+dr)/2;
if(bruh(mid)<n) st=mid;
else dr=mid;
}
cout<<dr;
return 0;
}