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