Run ID:38565
提交时间:2022-09-12 11:26:36
#include<iostream> using namespace std; bool f(int x){ int a=0,b=0; while(x>0){ if(x%2) a++; else b++; x/=2; } return a>b; } int main(){ int a=0,b=0; int i; for(i=1;i<=1000;i++){ if(f(i)) a++; else b++; } cout<<a<<' '<<b; return 0; }