Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
158513 章泽原 二进制数问题 C++ Accepted 1 MS 268 KB 505 2026-08-22 13:51:25

Tests(1/1):


Code:

#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; }