1 #include <iostream>
2 using namespace std;
3
4 #include <stdlib.h>
5 #include <sys/types.h>
6
7 int Count(u_int32_t n)
8 {
9 int count = 0;
10 while (n) {
11 ++count;
12 n = n & (n - 1);
13 }
14 return count;
15 }
16
17 int main()
18 {
19 cout << Count(128) << endl;
20
21 return 0;
22 }

相关文章:

  • 2021-12-12
猜你喜欢
  • 2021-09-02
  • 2021-10-11
  • 2021-06-02
  • 2021-11-08
  • 2022-03-05
  • 2022-12-23
  • 2022-01-11
相关资源
相似解决方案