题解 P1088 【火星人】
lingerleaf · · 题解
这道题只要自带函数背得多,两分钟之内解决 了解自带函数真的有用啊!
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin>>n>>m;
int ord[n+1];
for(int i=1;i<=n;++i) cin>>ord[i];
for(int i=1;i<=m;++i) next_permutation(ord+1,ord+1+n);
for(int i=1;i<n;++i) cout<<ord[i]<<' ';
cout<<ord[n];
}