Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
163511 邓弘锐 二进制数问题 C++ Accepted 1 MS 264 KB 355 2026-10-25 15:26:13

Tests(1/1):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int a=0,b=0,k,c,g,suma=0,sumb=0; for(int i=1;i<=1000;i++){ k=i; a=0; b=0; while(k>0){ c=k%2; k/=2; if(c==1) a++; else b++; } if(a>b){ suma++; } else{ sumb++; } } cout<<suma<<" "<<sumb; return 0; }