蓝桥杯-排列数
使用STL->next_permutation();
#include<cstdio>
#include<algorithm>
#include<iostream>
using namespace std;
int main() {
int count = 0;
int n;
scanf("%d", &n);
string s1 = "0123456789";
do {
count++;
if (count == n) {
cout << s1 << endl;
}
}while(next_permutation(s1.begin(), s1.end()));
return 0;
}
速度慢了点 不过可以使用dfs来优化