提交时间:2024-08-20 14:44:49
运行 ID: 168918
#include<bits/stdc++.h> using namespace std; int main() { int j,a,b,mod,xa=0,xb=0,x,y; cin>>x>>y; for(;x<=y;x++){ j=x,a=0,b=0; while(j){ mod=j%2; j>>=1; if(mod) a++; else b++; } if(a>b) xa++; else xb++; } cout<<xa<<' '<<xb; return 0; }