| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 157868 | 王慕哲 | 二进制数问题 | C++ | Compile Error | 0 MS | 0 KB | 558 | 2026-08-18 17:41:18 |
#include <iostream> using namespace std; int main() { int countA = 0, countB = 0; for (int n = 1; n <= 1000; n++) { int ones = 0, zeros = 0; int m = n; // 不断除以2,统计二进制中1和0的个数 while (m > 0) { if (m % 2 == 1) ones++; else zeros++; m /= 2; } if (ones > zeros) countA++; else countB++; } cout << "A类数个数: " << countA << endl; cout << "B类数个数: " << countB << endl; return 0;
Main.cc: In function 'int main()':
Main.cc:25:13: error: expected '}' at end of input
return 0;
^