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