标签:
class Solution { public: int NumberOf1(int n) { int cnt = 0; while(n) { n = n&(n-1); cnt ++; } return cnt; } };
[nowCoder] 二进制中1的个数
原文地址:http://www.cnblogs.com/diegodu/p/4633531.html