#include<bits/stdc++.h>
using namespace std;
int main() {
int a[3]={4,2,5};
sort(a,a+3);//必须事先排好序
do{
for(int i=0;i<3;i++){
cout<<a[i]<<" ";
}
cout<<endl;
}while(next_permutation(a,a+3));
return 0;
}
C++ 全排列函数next_permutation
最新推荐文章于 2024-10-03 02:04:54 发布