#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <stack>
#include <map>
using namespace std;
//一个int数有多少个一
int main(){
int n;
while(cin>>n){
int count=0;
while(n){
count+=(n&0x01);
n>>=1;
}
cout<<count<<endl;
}
return 0;
}
一个int数的二进制有多少个一
最新推荐文章于 2023-04-01 16:41:37 发布