提交时间:2023-11-04 09:08:03

运行 ID: 108625

# include <bits/stdc++.h> using namespace std ; bool isu [10] ; int x , tot = 0 int pln [10] ; void pl ( int k ) { if ( k == x + 1 ) { for ( int i = 1 ; i <= x ; i ++ ) { cout << pln [i] ; } cout << endl ; tot ++ ; return ; } for ( int i = 1 ; i <= x ; i ++ ) { if ( !isu [i] ) { isu [i] = true ; pln [k] = i ; pl ( k + 1 ) ; isu [i] = false ; } } return ; } int main ( ) { cin >> x ; pl ( 1 ) ; cout << tot << endl ; return 0 ; }