Files
python/C++专题课程/全排列/ShjCppStudy/STL实现全排列.cpp

21 lines
348 B
C++
Raw Normal View History

2025-08-30 18:35:01 +08:00
#include<bits/stdc++.h>
using namespace std;
//C++STL<54><4C>ȫ<EFBFBD><C8AB><EFBFBD>к<EFBFBD><D0BA><EFBFBD>next_permutation<6F><6E>ʹ<EFBFBD><CAB9>
// https://blog.csdn.net/ac_gibson/article/details/45308645
int main()
{
int a[3] = { 3,1,2 };
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
sort(a, a + 3);
//ȫ<><C8AB><EFBFBD><EFBFBD>
do
{
cout << a[0] << a[1] << a[2] << endl;
} while (next_permutation(a, a + 3));
return 0;
}