提交时间:2023-08-23 21:03:20

运行 ID: 99808

#include <iostream> using namespace std; int main() { int s1=0,s2=0; int x,y; cin>>x>>y; for(;x<=y;x++) { int j=x; int a=0; int b=0; int m=0; while(j) { m=j%2; j=j>>1; if(m) { a++; } else { b++; } } if(a>b) { s1++; } else { s2++; } } cout<<s1<<' '<<s2; return 0; }