HDU1027 Ignatius and the Princess II
来源:互联网 发布:增值税发票识别软件 编辑:程序博客网 时间:2024/06/08 12:07
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1027
解题思路:
求第m个全排列。直接用上STL里面的next_permutation库函数即可。
AC代码:
#include<iostream>#include<cstdio>#include<algorithm>using namespace std;int main(){ int n,m; while(scanf("%d%d",&n,&m)!=EOF) { int i,a[1010]; for(i=0;i<n;i++) a[i]=i+1; for(i=0;i<m-1;i++) next_permutation(a,a+n); for(i=0;i<n-1;i++) printf("%d ",a[i]); printf("%d\n",a[n-1]); } return 0;}
0 0
- hdu1027-Ignatius and the Princess II
- HDU1027 Ignatius and the Princess II
- HDU1027(Ignatius and the Princess II)
- HDU1027 Ignatius and the Princess II
- Hdu1027 Ignatius and the Princess II
- HDU1027 Ignatius and the Princess II
- HDU1027 Ignatius and the Princess II
- HDU1027 Ignatius and the Princess II
- hdu1027 Ignatius and the Princess II(排列问题)
- HDU1027 Ignatius and the Princess II 【next_permutation】【DFS】
- hdu1027 Ignatius and the Princess II(全排列)
- HDU1027 - Ignatius and the Princess II (深搜)
- ACM-简单题之Ignatius and the Princess II——hdu1027
- hdu1027 Ignatius and the Princess II (全排列 & STL中的神器)
- HDU1027——Ignatius and the Princess II(全排列)
- Ignatius and the Princess II
- Ignatius and the Princess II
- Ignatius and the Princess II
- nyoj-216-A problem is easy
- JQuery常用操作
- 透析SPFA算法(图例讲解)
- 《极度分裂》经典名句
- jQuery选择器总结
- HDU1027 Ignatius and the Princess II
- 闲言碎语
- Maven原理和Maven2新特性
- bzoj 2038: [2009国家集训队]小Z的袜子(hose)
- 强连通汇总
- C++ primer plus(第六版)学习笔记、习题答案(2)
- iphone开发/ios开发编程罗盘/指南针开发
- jbpm学习二
- 单调递增子序列(二)(南阳oj214)