hdoj1027 Ignatius and the Princess II(全排列)
来源:互联网 发布:三菱plc fx编程手册 编辑:程序博客网 时间:2024/06/05 12:08
要是真的是我去救公主,感觉公主应该早被吃了。。。。
关键就是有个全排列的函数next_permutation()
知道这个函数,问题就特别简单了。
#include<iostream>#include<stdio.h>#include<algorithm>using namespace std;int a[1005];int main(){int i,n,m;while(cin>>n>>m){for(i=1;i<=n;i++)a[i]=i;for(i=1;i<m;i++)next_permutation(a+1,a+1+n);for(i=1;i<n;i++){cout<<a[i]<<" ";}cout<<a[i]<<endl;}return 0;}
阅读全文
0 0
- hdoj1027 Ignatius and the Princess II(全排列)
- hdoj1027 Ignatius and the Princess II
- HDOJ1027 Ignatius and the Princess II
- hdu1027 Ignatius and the Princess II(全排列)
- hdoj Ignatius and the Princess II (全排列)
- HDU 1027 Ignatius and the Princess II(全排列)
- HDOJ1027 Ignatius and the Princess II&&STL神器
- HDU 1027 Ignatius and the Princess II 全排列
- hdu 1027 Ignatius and the Princess II 全排列
- HDU 1027 Ignatius and the Princess II (STL全排列)
- hdu 1027 Ignatius and the Princess II (STL 全排列)
- HDU 1027 Ignatius and the Princess II 全排列
- HDOJ 1027Ignatius and the Princess II(全排列)
- HDOJ 1027-Ignatius and the Princess II【全排列】
- hdoj 1027 Ignatius and the Princess II(全排列变形)
- hdoj 1027 Ignatius and the Princess II 【全排列】【STL】
- hdu 1027 Ignatius and the Princess II(STL全排列)
- hdu 1027 Ignatius and the Princess II (全排列)
- 仿微信的录制小视频功能
- 蓝桥杯决赛----加法变乘法
- Hibernate 关系关联映射和cascade与inverse
- 网站高并发 大流量访问的处理及解决方法
- BFS解决一般性的泊松分酒问题
- hdoj1027 Ignatius and the Princess II(全排列)
- 权限模型
- Alphago二胜有感
- 编程之美2.5 寻找最大的K个数
- 【Linux多线程】同步与互斥的区别
- JSP 猜字母游戏
- 百度地图与廊坊交警宣布合作 打造华北区“智慧出行”又一模范城市
- 爬虫之爬取知乎下某个问题下的全部图片(处理AJAX请求,解析json数据)
- 微信视频的录制按钮