Run ID:157892
提交时间: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; }