2021-12-23から1日間の記事一覧
コインを3回投げた時の表裏の出方は、全部で8通り(23)あるが、 これらの全パターンは、次のように全探索することができる。(表を○、裏を×とする) ※(1 << n) は 2n と表せる。 #include <iostream> #include <vector> using namespace std; int main() { int n = 3; for (int bi</vector></iostream>…
コインを3回投げた時の表裏の出方は、全部で8通り(23)あるが、 これらの全パターンは、次のように全探索することができる。(表を○、裏を×とする) ※(1 << n) は 2n と表せる。 #include <iostream> #include <vector> using namespace std; int main() { int n = 3; for (int bi</vector></iostream>…