c++ 标准库bitset;
#include <bitset>; class Solution { public: int NumberOf1(int n) { bitset<32> a(n); return a.count(); } };