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 ( ...
随机推荐
- SpringMVC启动流程源码解密
我们知道,SpringMVC最后是通过Tomcat来进行部署的.当在Servlet中进行进行应用部署时,主要步骤为(引用来自http://download.oracle.com/otn-pub/jcp ...
- phpstorm配置git并解决Terminal 中文乱码(Unicode 编码)的方法
前言:在使用PHPstorm的时候,需要用到terminal,主要还是用这个操作git,但是在使用这个的时候会发现,代码里所有中文都是乱码状态,不利于使用,下面就来看看怎么解决这个问题 一.先在php ...
- CCPC-wannafly Camp Day2 讲课内容总结(杜瑜皓-数据结构)
·栈.单调栈 1.栈的特点与基本操作 2.单调栈 单调栈是一种特殊的栈,其栈内的元素都保持一个单调性(单调递增或者递减). ·单调递增栈,从栈底到栈顶依次递增(单调非递减栈:允许有相等) ·单调递减栈 ...
- A complex 16-Level XSS Challenge
A complex 16-Level XSS Challenge, held in summer 2014 (+1 Hidden Level) Index Level 0 Level 1 Level ...
- 在ubuntu18.04下搭建kvm
前一段时间一直在尝试Ubuntu上搭建xen,一直出现各种问题,各种坑 首先先感谢下面这个公司对我的耐心解答,非常感谢.特别是后面来的电话对我进行了详细的解答,所以选择搭建kvm. 1. 需要检查一下 ...
- Ubuntu学习之路1
最近重装了系统,对自己很久的win7 say goodBye.学习了自制U盘系统盘,重装了win8,然后在win8上倒腾,发现还是不错的.于是又在win8上装回了win7上的VMware,捣鼓了一下U ...
- 对于Python中的字节串bytes和字符串以及转义字符的新的认识
事情的起因是之前同学叫我帮他用Python修改一个压缩包的二进制内容用来做fuzz,根据他的要求,把压缩包test.rar以十六进制的方式打开,每次修改其中一个十六进制字符串并保存为一个新的rar用来 ...
- 19_08_26校内训练[Max]
题意 求$max_{l \leq r}{\{min{\{a_l,a_{l+1},...,a_r\}}*(r-l+1)\}}$ 思考 分治,考虑一个区间跨过某个点的贡献即可. 代码 #include&l ...
- SpringBoot2.x整合JDBC及初始化data.sql和schema.sql脚本
今天在使用SpringBoot2.x版本整合JDBC时遇到了一些问题:由于我之前一直用SpringBoot1.5的版本,所以直接在yml里按照1.5的版本配置了属性,没想到2.x直接不能用了.首先是数 ...
- Oracle数据库、实例、用户、表空间、表之间的关系
完整的Oracle数据库通常由两部分组成:Oracle数据库和数据库实例. 1) 数据库是一系列物理文件的集合(数据文件,控制文件,联机日志,参数文件等): 2) Oracle数据库实例则是一组Ora ...