#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int A,B;
bool turn(int x)
{int a=0,b=0;
while(x!=0)
{if(x%2==1)a++;else b++;
x/=2;}
return a>b;//是A类数
}
int main()
{
for(int i=1;i<=1000;i++)
{if(turn(i)==1)
A++;
else
B++;
}
cout<<A<<" "<<B<<endl;
}
二进制分类
于 2018-01-19 10:13:16 首次发布