提交时间:2024-08-20 17:40:57
运行 ID: 169853
#include <iostream> #include <algorithm> #include <cmath> #include <cstdio> #include <string> using namespace std; double a[1010][1010]={{0.0}}; int main() { int a,b; cin>>a>>b; int A=0,B=0; for (int i = a; i <= b; i++){ int a1=i,o=0,z=0; while (a1!=0){ if(a1%2) o++; else z++; a1/=2; } if(o>z) A++; else B++; } cout<<A<<' '<<B<<endl; return 0; }