#include<stdio.h>

#include<algorithm>

using namespace std;

int a[1100];

int main() {

 int n,m,i;

 while(scanf("%d%d",&n,&m)!=EOF) {

  for(i=1;i<=n;i++)

   a[i]=i;

  for(i=1;i<m;i++)

   next_permutation(a+1,a+n+1);

  printf("%d",a[1]);

  for(i=2;i<=n;i++)

   printf(" %d",a[i]);

  printf("\n");

 }

 return 0;

}

hdu 1027的更多相关文章

  1. (全排列)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 ...

  2. 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 ...

  3. HDU 1027 G - Can you answer these queries?

    http://acm.hdu.edu.cn/showproblem.php?pid=4027 Can you answer these queries? Time Limit: 4000/2000 M ...

  4. HDU 1027 Ignatius and the Princess II(康托逆展开)

    Ignatius and the Princess II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K ( ...

  5. HDU 1027 Ignatius and the Princess II 选择序列题解

    直接选择序列的方法解本题,可是最坏时间效率是O(n*n),故此不能达到0MS. 使用删除优化,那么就能够达到0MS了. 删除优化就是当须要删除数组中的元素为第一个元素的时候,那么就直接移动数组的头指针 ...

  6. HDU 1027 - Ignatius and the Princess II

    第 m 大的 n 个数全排列 DFS可过 #include <iostream> using namespace std; int n,m; ]; bool flag; ]; void d ...

  7. HDU 1027(数字排列 STL)

    题意是求 n 个数在全排列中的第 m 个序列. 直接用 stl 中的 next_permutation(a, a+n) (这个函数是求一段序列的下一个序列的) 代码如下: #include <b ...

  8. hdu 1027 输出第m个全排列(next_permutation)

    Sample Input6 4 //输出第4个全排列11 8 Sample Output1 2 3 5 6 41 2 3 4 5 6 7 9 8 11 10 # include <cstdio& ...

  9. HDU 1027 打印沙漏

    https://pintia.cn/problem-sets/994805260223102976/problems/994805294251491328 本题要求你写个程序把给定的符号打印成沙漏的形 ...

  10. HDU 1027 Ignatius and the Princess II 排列生成

    解题报告:1-n这n个数,有n!中不同的排列,将这n!个数列按照字典序排序,输出第m个数列. 第一次TLE了,没注意到题目上的n和m的范围,n的范围是小于1000的,然后m的范围是小于10000的,很 ...

随机推荐

  1. fastboot命令详解

    Android手机分区(每个分区都有相应的img文件对应):开机启动画面区(splash1),数据恢复区(recovery),内核区(boot), 系统区(system),数据缓存区(cache),用 ...

  2. Nuget 自定义配置(官网)

    <?xml version="1.0" encoding="utf-8"?> <configuration> <config> ...

  3. Web自动化测试框架-PO模式

    Web自动化测试框架(WebTestFramework)是基于Selenium框架且采用PageObject设计模式进行二次开发形成的框架. 一.适用范围:传统Web功能自动化测试.H5功能自动化测试 ...

  4. 一个页面通过iframe,获取另一个页面的form

    document.getElementsByTagName("iframe")[0].contentWindow.document.forms[0].submit(); var z ...

  5. .net简单的fileupload控件上传

    前台代码: <asp:FileUpload ID="FileUpload1" runat="server" /> <asp:Button ID ...

  6. AJPFX: Java基础多线程(一)

    多线程是Java学习的非常重要的方面,是每个Java程序员必须掌握的基本技能.本文只是多线程细节.本质的总结,并无代码例子入门,不适合初学者理解.初学者学习多线程,建议一边看书.看博文,以便写代码尝试 ...

  7. Activiti工作流和shiro权限管理关系图

  8. MyHome3D在线装修设计软件测评

    人人都是设计师 ——MyHome3D在线装修设计软件 关键词:云技术,3D呈现效果,自主设计,简单易用,家具装修设计 上海爱福窝云技术有限公司借助于前沿的3D渲染技术,降低了装修设计的门槛,真正实现了 ...

  9. (转)淘淘商城系列——dubbo监控中心

    http://blog.csdn.net/yerenyuan_pku/article/details/72777623 之前我们就已学过了dubbo,想必大家对dubbo的架构有所了解,dubbo的架 ...

  10. image和TFRecord互相转换

    关说不练假把式.手上正好有车牌字符的数据集,想把他们写成TFRecord格式,然后读进来,构建一个简单的cnn训练看看.然后发现准确率只有0.0x.随机猜也比这要好点吧.只能一步步检查整个过程.暂时想 ...