#includeusing namespace std;int main(){ int n; cin >> n; int count = 0; while(n) { n = n&(n-1); count++; } cout << count << endl; return 0;}
本文共 246 字,大约阅读时间需要 1 分钟。
#includeusing namespace std;int main(){ int n; cin >> n; int count = 0; while(n) { n = n&(n-1); count++; } cout << count << endl; return 0;}
转载于:https://www.cnblogs.com/zyqBlog/p/5962377.html