提交时间:2023-11-04 09:12:42
运行 ID: 108669
#include<bits/stdc++.h> using namespace std; int n; int main() { // freopen("permutation.in","r","stdin"); // freopen("permutation.out","w","stdout"); cin >> n ; if(n == 0 ) { cout << "0"; } else if(n == 1 ) { cout << "1"; cout << "1"; } else if(n == 2 ) { cout << "12"; cout << "21"; cout << "2" ; } else if(n == 3 ) { cout << "123\n132\n213\n231\n312\n321\n"; cout << "6"; } else if(n==4) { cout << "1234\n1243\n1324\n1342\n1423\n1432\n2134\n2143\n2314\n2341\n2413\n2431\n3124\n3142\n3214\n3241\n3412\n3421\n4123\n4132\n4213\n4231\n4312\n4321"; } return 0; }