提交时间:2024-08-19 15:21:18
运行 ID: 166770
#include <bits/stdc++.h> using namespace std; int a,b,j,m,suma = 0,sumb = 0,x,y; int main() { cin >> x >> y; for(;x <= y;x++) { j = x,a = 0,b = 0; while(j) { m = j % 2; j /= 2; if(m) a++; else b++; } if(a > b) suma++; else sumb++; } cout << suma << ' ' << sumb; }