HDU Ignatius and the Princess II 全排列下第K大数
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<iostream>
using namespace std;
#define ll long long
#define N 110000
int s[N];
int main(void)
{
int n, m;
while(scanf("%d%d", &n, &m) != EOF)
{
for(int i = 0; i < n; i++)
s[i] = i + 1;
int t = 1;
int flag = 0;
while(next_permutation(s, s + n))
{
if(flag == 1)
break;
t++;
if(t == m)
{
flag = 1;
for(int i = 0; i < n; i++)
{
if(i != 0 )
printf(" ");
printf("%d", s[i]);
}
}
}
printf("\n");
}
return 0;
}
HDU Ignatius and the Princess II 全排列下第K大数的更多相关文章
- HDU - 1027 Ignatius and the Princess II 全排列
Ignatius and the Princess II Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K ( ...
- poj 1027 Ignatius and the Princess II全排列
Ignatius and the Princess II Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K ( ...
- hdu Ignatius and the Princess II
Ignatius and the Princess II Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Ja ...
- HDU 1027 Ignatius and the Princess II(求第m个全排列)
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1027 Ignatius and the Princess II Time Limit: 2000/10 ...
- (全排列)Ignatius and the Princess II -- HDU -- 1027
链接: http://acm.hdu.edu.cn/showproblem.php?pid=1027 Ignatius and the Princess II Time Limit: 2000/100 ...
- HDU 1027 Ignatius and the Princess II[DFS/全排列函数next_permutation]
Ignatius and the Princess II Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K ( ...
- Ignatius and the Princess II(全排列)
Ignatius and the Princess II Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K ( ...
- hdu1027 Ignatius and the Princess II (全排列 & STL中的神器)
转载请注明出处:http://blog.csdn.net/u012860063 题目链接:http://acm.hdu.edu.cn/showproblem.php? pid=1027 Ignatiu ...
- HDU 1027 Ignatius and the Princess II(康托逆展开)
Ignatius and the Princess II Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K ( ...
随机推荐
- 初探ASP.NET Core 3.x (1) - 关于ASP.NET Core
I 什么是ASP.NET Core ASP.NET is an open source web framework, created by Microsoft, for building modern ...
- Maven 基础环境搭建 项目依赖jar包导入
一.创建一个Maven工程 不清楚的话请查阅其它文档. 二.引入项目依赖的jar包 1.Spring 2.SpringMvc 3.Mybatis 4. 数据库连接池,驱动 5.其它(jstl.serv ...
- 计算机基础——常用的Dos命令
d:——切换指定硬盘分区 cd——切换目录,例如:cd D:\下载(使用此命令之前先使用 d: 命令) netstat -ano——查看所有端口号 netstat -a——查看开启了哪些端口 nets ...
- 安装numpy、matplotlib
一.安装numpy 1.下载 https://pypi.org/project/numpy/#files 2.安装 pip3 install numpy-1.17.3-cp37-cp37m-win_a ...
- C# 自动批量搜索指定关键字,没有注册的域名
做好网站了,部署上线.想注册域名,但是想了很多要注册的,都被别人注册了.例如已经做好了体育资讯的网站,想要包含关键字sport的域名,就可以用这个工具自动完成搜索. 效果如下图: 演示程序结构 在vs ...
- 双指针,BFS与图论(一)
(一)双指针 1.日志统计 小明维护着一个程序员论坛.现在他收集了一份”点赞”日志,日志共有 N 行. 其中每一行的格式是: ts id 表示在 ts 时刻编号 id 的帖子收到一个”赞”. 现在小明 ...
- AI领域有什么职业?怎样才能在AI领域找到工作?
AI领域是一个很吃香的行业,在这个行业中,很多人都是高薪的,而且有些学生为了以后能够接触到这个行业,都在大学的时候,学习这个专业,那么大家知道AI领域有什么职业吗?下面我们就来给大家讲解一下. 1.算 ...
- if循环后打印数据竖行输出和横排输出
代码A如下: def func(*kargs): return kargs, l = func(5,3,4,5,6) for i in l: print (i) 打印结果: ...
- Zabbix添加SNMP自定义监控项OID出现“No Such Instance currently exists at this OID”
原因:zabbix 是用snmpget来获取指定的OID数据,snmpwalk是遍历某个OID下的数据. 所以一定要用snmpget来验证某个OID是否正确. snmptranslate 获取的OID ...
- CSS-12-盒子模型
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...