可重集的排列:投机取巧的做法,利用STL的next_permutation
2015-06-04 21:48
393 查看
#include <iostream> #include <algorithm> using namespace std; int main() { int p[5] = {4, 1, 1, 4, 1}; sort(p, p+5); //排序 do { for (int i = 0; i < 5; i++) { printf("%d ", p[i]); } printf("\n"); } while (next_permutation(p, p+5)); return 0; }
相关文章推荐
- easyui提交表单数据的时候如何防止二次提交
- NABC模型进行需求分析
- Cpp Primer<<学习IO标准库--面向对象的标准库_4
- 第一篇 android_AR_导航
- PS常用技巧
- 随想录(简单的windows驱动代码)
- 有多少1
- hdu 5113 Black And White
- xUtils
- VS2010 创建和调用动态链接库
- POJ3276 Face The Right Way--反转问题初学
- C语言函数使用
- Android多线程从入门到精通
- POJ3276 Face The Right Way--反转问题初学
- 课程改进意见
- PAT 1007 Course List for Student (25)
- LTE中的名词解释(分集增益 RSRP RSRQ SINR AWGN 空中接口)
- SpeechMarker API 与端点检测
- poj 3311 2进制状态压缩dp,tsp
- MySQL行级锁、表级锁、页级锁详细介绍