题目链接:POJ 1833

/************************************
* author : Grant Yuan
* time : 2014/10/19 16:38
* source : POJ 1833
* algorithm: STL+排列的生成
*************************************/
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
int str[1030];
int ans[1030];
int n,k,t;
int main()
{
scanf("%d",&t);
while(t--){
memset(str,0,sizeof(str));
scanf("%d%d",&n,&k);
for(int i=0;i<n;i++)
{
scanf("%d",&str[i]);
}
for(int i=1;i<=k;i++)
{
bool b=next_permutation(str,str+n);
}
for(int j=0;j<n;j++)
{
if(j!=n-1) printf("%d ",str[j]);
else printf("%d\n",str[j]);
}
}
return 0;
}

最新文章

  1. 汇编实现点亮Led灯(2440)
  2. ConcurrentDictionary线程不安全么,你难道没疑惑,你难道弄懂了么?
  3. OpenCV成长之路(2):图像的遍历
  4. HDU 5120 Intersection(2014北京赛区现场赛I题 计算几何)
  5. 猿题库 iOS 客户端架构设计-唐巧
  6. Delphi关于记录文件的操作
  7. (easy)LeetCode 203.Remove Linked List Elements
  8. string,vector和array(C++ Primer读书笔记)
  9. Powershell变量的类型和强类型
  10. shell脚本,符号
  11. springboot学习(三)————使用HttpMessageConverter进行http序列化和反序列化
  12. Linux之部署前后端分离项目
  13. Luogu5289 十二省联考2019皮配(动态规划)
  14. js 获取字符串中所有的数字和汉字
  15. spring4笔记----“零配置”:spring提供的几个Annotation标注
  16. python基础——高级特性
  17. [jzoj]1729.blockenemy
  18. 【Java】 剑指offer(57-1) 和为s的两个数字
  19. 【springBoot】之快速构建一个web项目
  20. rank() over,dense_rank(),row_number() 的区别

热门文章

  1. 39.C语言操作数据库
  2. OpenCV —— 写入AVI视频文件
  3. 阅读笔记—MVC
  4. ios UITextView 提示文本
  5. Git管理软件
  6. Hibernate之关于多对多单向关联映射
  7. Web页面转换成Word文件,利用wordXML
  8. 借Stunnel工具保护E-mail服务器
  9. SQL创建数据库、表、存储过程及调用
  10. InstallShield详细制作说明(三)