您的位置:首页 > 其它

hdu 1027 Ignatius and the Princess II

2013-07-14 22:04 411 查看
之前不用stl,代码敲了n久。。。。

不得不说,stl真是个好东西,有了它,很多步骤都能方便很多了

#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int ans[10005];
int main()
{
int n,m,i;
while(scanf("%d%d",&n,&m)!=-1)
{
for(i=0;i<n;i++)ans[i]=i+1;
while(--m)
next_permutation(ans,ans+n);
printf("%d",ans[0]);
for(i=1;i<n;i++)
printf(" %d",ans[i]);
printf("\n");
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: