提交时间:2023-10-08 14:00:44
运行 ID: 105878
#include<iostream> #include <algorithm> using namespace std; int a[15]; int main() { int n; cin >> n; int cnt = 1; for(int i = 1;i <= n;i++) { a[i] = n - i + 1; cnt = i; } for(int i = 1;i <= cnt;i++) { next_permutation(a + 1 , a + n + 1); for(int j = 1;j <= n;j++) cout << a[j]; cout << endl; } cout << cnt; return 0; }