ビット全探索
1func bitExhaustiveSearch(n int, fn func(a []bool)) {
2 all := 1 << uint(n)
3 a := make([]bool, n)
4 for i := 0; i < all; i++ {
5 for j := 0; j < n; j++ {
6 if i>>uint(j)&1 == 1 {
7 a[j] = true
8 } else {
9 a[j] = false
10 }
11 }
12 fn(a)
13 }
14}
15