Run ID:158513
提交时间:2026-08-22 13:51:25
#include <iostream> using namespace std; int main() { int A = 0, B = 0; //遍历 1~1000 for(int x = 1; x <= 1000; x++) { int one = 0, zero = 0; int tmp = x; while(tmp > 0) { if(tmp % 2 == 1) one++; else zero++; tmp = tmp / 2; } if(one > zero) A++; else B++; } cout << A << " " << B << endl; return 0; }