You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
#include<bits/stdc++.h>
|
|
using namespace std;
|
|
int main() {
|
|
//注意:这个数组的数字要先排好顺序,由小到大,否则只输出比现在大的全排列!
|
|
int num[5]= {3,1,2,4,5};
|
|
//快速排序
|
|
sort(num, num+5);
|
|
//输出全排列
|
|
do {
|
|
cout<<num[0]<<" "<<num[1]<<" "<<num[2]<<" "<<num[3]<<" "<<num[4]<<endl;
|
|
} while(next_permutation(num,num+5));
|
|
return 0;
|
|
}
|
|
|