提交时间:2024-08-19 21:50:36
运行 ID: 168016
#include<cstdio> int a,b,i,i2,k,sum0,sum1,ans0,ans1; int main() { scanf("%d %d",&a,&b); for(i=a;i<=b;i++) { i2=i; sum0=0; sum1=0; while(i2>0) { k=i2%2; if(k==0)sum0++; else if(k==1)sum1++; i2/=2; } if(sum0>=sum1)ans0++; else ans1++; } printf("%d %d",ans1,ans0); return 0; }