提交时间:2024-08-19 21:49:53

运行 ID: 168015

#include<iostream> using namespace std; int alei; int blei; int main() { for(int i=1;i<=1000;i++) { int yi=0; int ling=0; int now=i;//记录i的值 while(now!=0) { int r=now%2; if(r==1)yi++; else if(r==0)ling++; now=now/2; } if(yi>ling)alei++; else blei++; } cout<<alei<<" "<<blei; return 0; }