hdu1027
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int SIZE=1002;
int main()
{
int n,m;
int i,count;
int seq[SIZE];
while(scanf("%d %d",&n,&m)!=EOF)
{
for(i=0;i<SIZE;i++)
seq[i]=i+1;
count=0;
do
{
count++;
if(count==m)
{
for(i=0;i<n;i++)
if(i==n-1)
cout<<seq[i];
else
cout<<seq[i]<<" ";
cout<<endl;
break;
}
}
while (next_permutation(seq,seq+n));
}
return 0;
}
hdu1027的更多相关文章
- HDU1027 Ignatius and the Princess II( 逆康托展开 )
链接:传送门 题意:给出一个 n ,求 1 - n 全排列的第 m 个排列情况 思路:经典逆康托展开,需要注意的时要在原来逆康托展开的模板上改动一些地方. 分析:已知 1 <= M <= ...
- ACM-简单题之Ignatius and the Princess II——hdu1027
转载请注明出处:http://blog.csdn.net/lttree Ignatius and the Princess II Time Limit: 2000/1000 MS (Java/Othe ...
- HDU1027 Ignatius and the Princess II 【next_permutation】【DFS】
Ignatius and the Princess II Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K ( ...
- ACM-简单的主题Ignatius and the Princess II——hdu1027
转载请注明出处:http://blog.csdn.net/lttree Ignatius and the Princess II Time Limit: 2000/1000 MS (Java/Othe ...
- HDU1027 Ignatius and the Princess II
Problem Description Now our hero finds the door to the BEelzebub feng5166. He opens the door and fin ...
- 全排列-hdu1027
题目描述: 题目大意:现在给我们两个数字,N和M.我们应该编程找出由1到N组成的第M个最小序列.主要运用了全排列的思想,运用了全排列中next_permutation()函数: next_permut ...
- hdu1027 Ignatius and the Princess II (全排列 & STL中的神器)
转载请注明出处:http://blog.csdn.net/u012860063 题目链接:http://acm.hdu.edu.cn/showproblem.php? pid=1027 Ignatiu ...
- hdu1027(n个数的按字典序排列的第m个序列)
题目信息:给出n.m,求n个数的按字典序排列的第m个序列 http://acm.hdu.edu.cn/showproblem.php? pid=1027 AC代码: /** *全排列的个数(次序) ...
- next_permutation的使用-Hdu1027
Ignatius and the Princess II Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K ( ...
随机推荐
- 【译】Objectively Speaking 2: A Crash Course in Objective-C for iOS 6
In this Objective-C tutorial, you will create a simple movie quotes quiz app. Along the way, you’ll ...
- 寻找最大的k个数
这个题目是非常经典的一个题目,解法也有很多,现在就把我已经理解的解法记录下来. 题目描述 有n个无序的数,它们各不相等,怎样选出其中的最大的k个数呢? 题目分析: 解法1: 最容易想到的就是把n个数进 ...
- rcp(插件开发) 如何查找自己定义的扩展点
规则: 扩展点所在的插件ID(X)+扩展点的name(Y) 也就是 X.Y 具体代码 Platform.getExtensionRegistry().getExtensionPoint(X.Y).ge ...
- [原]Escape From the iOS Sanbox on Jailbreak Device
just my thinking, 3 ways to escape from sandbox on jailbreak device, to do file copying or execute s ...
- Build FFmpeg for iOS
FFmpeg Build Instructions MAC 10.8 or better Copy ffmpeg-2.0.tar.bz2 (https://ffmpeg.org/releases/ff ...
- 无穷字符串问题--CSDN上的面试题(原创)
网上看到一道奇怪的题,分享一下:http://hero.csdn.net/Question/Details?ID=307&ExamID=302 发布公司:CSDN 有 效 期:2014-02- ...
- IOS学习之路十九(JSON与Arrays 或者 Dictionaries相互转换)
今天写了个json与Arrays 或者 Dictionaries相互转换的例子很简单: 通过 NSJSONSerialization 这个类的 dataWithJSONObject: options: ...
- C++内存中的封装、继承、多态(上)
C++内存中的封装.继承.多态(上) 继我的上一篇文章:浅谈学习C++时用到的[封装继承多态]三个概念 此篇我们从C++对象内存布局和构造过程来具体分析C++中的封装.继承.多态. 一.封装模型的内存 ...
- YARN之上的大数据框架REEF:微软出品,是否值得期待?
YARN之上的大数据框架REEF:微软出品,是否值得期待? 摘要:微软即将开源大数据框架REEF,REEF运行于Hadoop新一代资源管理器YARN的上层.对于机器学习等在数据传输.任务监控和结果 ...
- 7z文件格式及其源码的分析
7z文件格式及其源码的分析 本文是一个系列. 主要是分享我最近一年做7z文件开发的经验. 主要包括7z官方源码的结构分析, 以及7z文件格式的分析. 其中涉及到7z源码结构的各个细节, 以及7z文件格 ...