返回1到n的所有组合python_如何在Python中生成0-1矩阵的所有可能组合?
生活随笔
收集整理的这篇文章主要介绍了
返回1到n的所有组合python_如何在Python中生成0-1矩阵的所有可能组合?
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
如何生成大小为K的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];
总结
以上是生活随笔为你收集整理的返回1到n的所有组合python_如何在Python中生成0-1矩阵的所有可能组合?的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: threading模块使用_thread
- 下一篇: sublime配置python开发环境_