hdu1027(next_permutation())
来源:互联网 发布:nginx lua waf 安装 编辑:程序博客网 时间:2024/06/03 16:33
主要是想介绍下next_permutation(a,a+n)这个函数,用法和sort相似
所需头文件#include <algorithm>
prev_permutation的用法和next_permutation() 相似
代码如下:
#include<iostream>#include<algorithm>#include<cstring>#include<stack>#include<queue>#include<set>#include<map>#include<stdio.h>#include<stdlib.h>#include<ctype.h>#include<time.h>#include<math.h>#define N 1005#define inf 0x7fffffff#define eps 1e-9#define pi acos(-1.0)#define P system("pause")using namespace std;int a[N];int main(){//freopen("input.txt","r",stdin);//freopen("output.txt","w",stdout); int n,m; while(scanf("%d%d",&n,&m) != EOF) { int i; for(i = 0; i < n; i++) a[i] = i+1; m--; while(m--)//求第m小的序列 next_permutation(a,a+n); printf("%d",a[0]); for(i = 1; i < n; i++) printf(" %d",a[i]); printf("\n"); } return 0;}
0 0
- hdu1027(next_permutation())
- HDU1027(next_permutation应用)
- HDU1027(next_permutation函数用法)
- hdu1027 全排列(STL函数next_permutation)
- hdu1027 next_permutation的应用
- HDU1027 Ignatius and the Princess II 【next_permutation】【DFS】
- hdu1027(使用next_permutation求第m小的全排列)
- hdu1027
- hdu1027
- hdu1027
- HDU1027
- hdu1027
- HDU1027(Ignatius and the Princess II)
- POJ1061(STL next_permutation)
- 全排列(next_permutation)
- (转载)关于next_permutation()
- next_permutation函数 (1)
- next_permutation(排列问题)
- Hibernate的工作原理
- linux 程序调试利器
- poj2081
- style.display与style.visibility的区别
- 标准C++中的string类的用法总结
- hdu1027(next_permutation())
- 十六进制,sizeof,strlen
- 跟面试官讲Binder(零)
- Python学习也任重道远
- 渗透测试方法与流程
- ZOJ 3621 Factorial Problem in Base K 分解质因数
- Android Handler的使用略
- DSS 搭建手机流媒体服务器(部分转载)
- TCP 中的EAGAIN错误