#include<iostream>
#include<cstdio>
#include<string>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<list>
#include<cstdlib>
#include<cstring>
using namespace std;
int main(){
int n,m;
while(cin>>n>>m){
int a[2000];
for(int i=0;i<n;i++){
a[i]=i+1;
}
int p;
p=0;
do{
p++;
if(p==m){
for(int i=0;i<n-1;i++){
cout<<a[i]<<" ";
}
cout<<a[n-1]<<endl;
break;
}
} while (next_permutation(a,a+n));
}
return 0;
}
STL专题-全排列
最新推荐文章于 2024-08-24 14:01:36 发布