#include<bits/stdc++.h>
using namespace std;
int main(){
int arr[] = {4,3,2,1};
int cnt = 0;
int len = sizeof(arr) / sizeof(arr[0]);
sort(arr,arr+len);
do
{
for(int i=0;i<len;i++)
{
printf("%d ",arr[i]);
}
printf("\n");
cnt++;
} while(next_permutation(arr,arr+len));
printf("%d\n",cnt);
return 0;
}
C++函数(next_permutation)
最新推荐文章于 2024-07-06 17:39:27 发布