# include <iostream>
# include <algorithm>
# include <stdio.h>
using namespace std;
int sequence[1010];
int main ()
{
int n,m,i,j;
while(cin>>n>>m)
{
for(i=0;i<n;i++)
sequence[i]=i+1;
for(i=2;i<=m;i++)
next_permutation(sequence,sequence+n);
for(i=0;i<n-1;i++)
printf("%d ",sequence[i]);
printf("%d\n",sequence[n-1]);
}
return 0;
}
对于全排列的理解 ………………next_permutation(sequence,sequence+n);
hdu 1027
最新推荐文章于 2021-07-22 19:16:58 发布