提交时间:2024-08-19 15:58:34

运行 ID: 167068

#include <bits/stdc++.h> using namespace std; int j, a, b, mod, ta, tb, x, y; int main() { cin >> x >> y; for(; x <= y; x++) { j = x; a = 0; b = 0; while(j) { mod = j % 2; j >>= 1; if(mod) a++; else b++; } if(a > b) ta++; else tb++; } cout << ta << " " << tb; return 0; }