提交时间:2024-08-20 20:31:44
运行 ID: 169942
#include <bits/stdc++.h> using namespace std; int main() { int a,b,s0=0,s1=0,sa=0,sb=0,m; cin >> a >> b; for (int i = a; i <= b; i++) { m=i; while (m) { if (m%2) { s1++; } else { s0++; } m=m>>1; } if (s1>s0) { sa++; } else { sb++; } s1=0; s0=0; } cout << sa << " " << sb; }