回答編集履歴
2
ソース修正
answer
CHANGED
@@ -8,11 +8,10 @@
|
|
8
8
|
usr ~/Project/test % cat t1.cpp
|
9
9
|
#include <iostream>
|
10
10
|
#include <bit>
|
11
|
-
#include <cstdint>
|
12
11
|
//
|
13
12
|
int main( )
|
14
13
|
{
|
15
|
-
|
14
|
+
uint32_t a = 0b111000;
|
16
15
|
std::cout << std::popcount(a) << "\n";
|
17
16
|
|
18
17
|
return 0;
|
1
ソース追記
answer
CHANGED
@@ -1,2 +1,20 @@
|
|
1
|
-
`
|
1
|
+
`#include <bit>
|
2
|
-
が必要です。
|
2
|
+
が必要です。
|
3
|
+
|
4
|
+
結果(clang 10)
|
5
|
+
```text
|
6
|
+
usr ~/Project/test % ./a.out
|
7
|
+
3
|
8
|
+
usr ~/Project/test % cat t1.cpp
|
9
|
+
#include <iostream>
|
10
|
+
#include <bit>
|
11
|
+
#include <cstdint>
|
12
|
+
//
|
13
|
+
int main( )
|
14
|
+
{
|
15
|
+
auto a = static_cast<std::uint32_t>(0b111000);
|
16
|
+
std::cout << std::popcount(a) << "\n";
|
17
|
+
|
18
|
+
return 0;
|
19
|
+
}
|
20
|
+
```
|