Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
157870 王垚植 二进制数问题 C++ Wrong Answer 1 MS 264 KB 558 2026-08-18 17:43:16

Tests(0/1):


Code:

#include <iostream> using namespace std; int main() { int A = 0, B = 0; for(int n = 1; n <= 1000; n++) { int x = n; int cnt1 = 0, cnt0 = 0; while(x > 0) { int bit = x % 2; if(bit == 1) cnt1++; else cnt0++; x /= 2; } if(cnt1 > cnt0) A++; else B++; } cout << "A类数个数:" << A << endl; cout << "B类数个数:" << B << endl; return 0; }


Run Info:

------Input------
0
------Answer-----
538 462
------Your output-----
A类数个数:538 B类数个数:462