| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 157888 | 王垚植 | 二进制数问题 | C++ | Accepted | 0 MS | 264 KB | 586 | 2026-08-18 18:08:30 |
#include <bits/stdc++.h> using namespace std; int main(){ int A=0,B=0; for (int i=1;i<=1000;i++){ int num=i; string s=""; while (num>0){ s=s+char(num%2+'0'); num/=2; } reverse(s.begin(),s.end()); int s0=0,s1=0; for (int j=0;j<s.length();j++){ if (s[j]=='0'){ s0++; } else{ s1++; } } if (s1>s0){ A++; } else{ B++; } } cout<<A<<" "<<B; return 0; }