提交时间:2024-07-30 17:03:34
运行 ID: 159683
# include <bits/stdc++.h> using namespace std ; bool cmp ( int x ) { int cnt1 = 0 , cnt2 = 0 ; while ( x > 1 ) { int t = x % 2 ; x /= 2 ; if ( t ) { cnt1 ++ ; } else { cnt2 ++ ; } } return cnt1 > cnt2 } int main ( ) { int a , b , ca = 0 , cb = 0 ; cin >> a >> b ; for ( int i = a ; i <= b ; i ++ ) { if ( cmp ( i ) ) { ca ++ ; } else { cb ++ ; } } cout << ca << ' ' << cb << endl ; return 0 ; }