Run ID:97299

提交时间:2024-11-12 17:41:38

#include<iostream> using namespace std; int main(){ int a,b,c,i; int totalZ,totalO,totalA,totalB; totalA=0; totalB=0; for(i=1;i<=1000;i++){ a=i; totalZ=0; totalO=0; do{ b=a/2; c=a%2; if(c == 0){ totalZ++; }else{ totalO++; } a=b; }while(b!=0); if(totalO>totalZ){ totalA++; }else{ totalB++; } } cout<<totalA<<"\t"<<totalB<<endl; return 0; }