【发布时间】:2016-10-10 07:40:25
【问题描述】:
如何生成大小为 K × N 的 0-1 矩阵的所有可能组合?
例如,如果我取 K=2 和 N=2,我得到以下组合。
combination 1
[0, 0;
0, 0];
combination 2
[1, 0;
0, 0];
combination 3
[0, 1;
0, 0];
combination 4
[0, 0;
1, 0];
combination 5
[0, 0;
0, 1];
combination 6
[1, 1;
0, 0];
combination 7
[1, 0;
1, 0];
combination 8
[1, 0;
0, 1];
combination 9
[0, 1;
1, 0];
combination 10
[0, 1;
0, 1];
combination 11
[0, 0;
1, 1];
combination 12
[1, 1;
1, 0];
combination 13
[0, 1;
1, 1];
combination 14
[1, 0;
1, 1];
combination 15
[1, 1;
0, 1];
combination 16
[1, 1;
1, 1];
【问题讨论】:
-
更像是一道算法题 --> programmers.stackexchange.com
标签: python combinations