{STL的全排列}hdoj1027
来源:互联网 发布:鉴衡认证中心 知乎 编辑:程序博客网 时间:2024/05/20 06:38
#include <stdio.h>
#include <algorithm>
int main()
{
int n,m;
int a[2000];
while (scanf("%d %d",&n,&m)!=EOF)
{
for (int i=0;i<n;++i)
a[i]=i+1;
for (int i=1;i<m;++i)
std::next_permutation(a,a+n);
printf("%d",a[0]);
for (int i=1;i<n;++i)
printf(" %d",a[i]);
puts("");
}
#include <algorithm>
int main()
{
int n,m;
int a[2000];
while (scanf("%d %d",&n,&m)!=EOF)
{
for (int i=0;i<n;++i)
a[i]=i+1;
for (int i=1;i<m;++i)
std::next_permutation(a,a+n);
printf("%d",a[0]);
for (int i=1;i<n;++i)
printf(" %d",a[i]);
puts("");
}
}
<algorithm>里面的next_permutation和prev_permutation的应用
(果然知多点少做多点)
- {STL的全排列}hdoj1027
- 全排列 hdoj1027
- hdoj1027 Ignatius and the Princess II(全排列)
- 全排列的STL实现
- 全排列的STL实现
- c++STl的全排列
- HDOJ1027 next_permutation求全排列
- hdoj1027【STL系列。。。?】
- STL 中 next_permutation 的全排列思路
- 全排列问题的STL用法
- D的小L 全排列 STL
- 全排列问题的递归、STL实现
- 用STL的写全排列
- C++STL全排列的简单实现
- STL 中的全排列
- STL 全排列 pku1833
- STL next_permutation 全排列
- STL-next_premunation(全排列)
- ogg for oracle to ogg for mysql
- python学习笔记之url.urlretrieve
- C语言之排序1
- hdu 2874 Connections between cities 最近公共祖先lca(离线算法/tarjan算法)
- Codeforces Round #198 (Div. 2) B. Maximal Area Quadrilateral
- {STL的全排列}hdoj1027
- cocos2d-x之TestCPP例子解析(2)-ActionsTest
- 简单工厂模式Static Factory Method
- hdu 4101 Ali and Baba (bfs+严密思维)
- GNU make中文手册 第五章 规则的命令
- s3c6410使用MFC-API进行MPEG-4格式解码及LCD播放代码注释
- 【给小公司培训的6个建议】
- Git追踪分支
- java中的i++与++i