文章
7
粉丝
319
获赞
5
访问
76.4k
#include <bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define debug freopen("in.txt","r",stdin),freopen("out.txt","w",stdout);
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn = 1e6+10;
const int maxM = 1e6+10;
const int inf = 0x3f3f3f3f;
int N;
int main(){
// debug;
// ios;
cin>>N;
int zero = 0,one = 0;
for(int i = 0;i<32;i++){
if(N & 1) one++;
else zero++;
N/=2;
}
printf("count0=%d count1=%d",zero,one);
return 0;
}
登录后发布评论
写的不错