提交时间:2023-08-21 20:41:15
运行 ID: 99070
#include <bits/stdc++.h> //#pragma GCC optimize(2) //#define int long long #define endl '\n' #define ll long long #define ull unsigned long long using namespace std; bool check(int n) { int one=0,zero=0; while(n) { if(n&1)one++; else zero++; n>>=1; } return one>zero; } signed main() { std::ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int a,b; cin >> a >> b; int A=0,B=0; for(int i = a; i <= b; i++) { if(check(i))A++; else B++; } cout << A << " " << B << endl; return 0; }