题解 | #送分了QAQ#
老子的全排列呢
https://ac.nowcoder.com/acm/problem/15128
思路
介绍一个函数next_permutation,他可以用来求一个序列的下一个排列情况,因此对于初始序列{1,2,3,4,5,6,7,8},一直输出他的下一个序列就好了。
代码
#include<bits/stdc++.h>
using namespace std;
int main(){
int a[]={1,2,3,4,5,6,7,8};
do{
for(int i=0;i<8;i++){
cout<<a[i];
if(i!=7) cout<<" ";
}
cout<<endl;
}while(next_permutation(a,a+8));
return 0;
} 
海康威视公司福利 1125人发布