标签:space pac nbsp clu name str pre mingw string
#include<iostream> #include<string> using namespace std; int hammingWeight(uint32_t n) { int ans = 0; while (n) { if (n % 2 == 1) { ans += 1; } n = n / 2; } return ans; } int main() { uint32_t a = 128; cout << hammingWeight(a) << endl; return 0; }
标签:space pac nbsp clu name str pre mingw string
原文地址:https://www.cnblogs.com/luo-c/p/12864808.html