[2016-01-19][C++][关于next_permutation]
时间:
2016-01-19 19:06:51
阅读:
122
评论:
收藏:
0
[点我收藏+]
[2016-01-19][C++][关于next_permutation]
[2016-01-19][POJ][1256]见POJ 1256
- next_permutation有第三个参数cmp函数地址,可以用来指定顺序...
- next_permutation生成方法
- 123456
- 取出6,
- 取出5,已经取出的数中有比5大的,把5替换成6,剩下部分按升序排列
- 123465
- 取出5,没有比5大的
- 取出6,没有比6大的
- 取出4,已经取出的数字(5,6)中存在有比4大的,把4替换成6,剩下部分按升序排列
- 123645
- 以此类推,直到654321
[2016-01-19][C++][关于next_permutation]
原文:http://www.cnblogs.com/qhy285571052/p/5143034.html