#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cstring>
#include<vector>
#include<map>
#include<set>
using namespace std;
const int inf=0x3fffffff;
const int maxn=10010;
int cnt_1(int n){// 一个数的二进制表示中 所具有的 1 的个数
int cnt=0;
while(n){
if(n&1) cnt++;
n>>=1;
}
return cnt;
}
string change(int n){ // 10 to 2
string str="";
while(n){
if(n&1) str='1'+str;
else str='0'+str;
n>>=1;
}
return str;
}
int main(){
// ios::sync_with_stdio(false);
// cin.tie(0),cout.tie(0);
int n=6; // 110;
cout<<cnt_1(n)<<endl;
cout<<change(n)<<endl;
if(n&1) cout<<"偶数"<<endl;
else cout<<"奇数"<<endl;
n^1 可以实现最后一位数的翻转
n&(-n) lowbit(10100)=100 lowbit运算
for(int i=0;i<(1<<3);i++){
// 对应数的二进制就表示相应的状态
// 如果用 0 表示灯不亮,1 表示灯亮 那么所有的状态就出来了
// 000
// 001
// 010
// 011
// 100
// 101
// 110
// 111
//然后可以根据题目条件对相应的状态进行判断
}
return 0;
}