提交时间:2024-10-05 13:39:08

运行 ID: 52411

#include <bits/stdc++.h> using namespace std; const int N=1e8+10; int number[N]; int Binary_search(int x,int l,int r){ int cnt = 0; while (l <= r){ cnt++; int mid = (l + r) / 2; if (mid == x){ return cnt; } if (mid < x) l = mid + 1; if (mid > x) r = mid - 1; } return cnt; } int main(){ int l,r,maxn=0; cin >> l >> r; int cnt,x=l; while(x<=r){ cnt=Binary_search(x,l,r); number[cnt]++; maxn=max(maxn,cnt); x++; } cout<<number[maxn]; return 0; }