提交时间:2023-11-04 09:13:04
运行 ID: 108671
# include <iostraem> using namespace standard ; int count = 0 , number ; bool is [10] = { true , true , true , true , true , true , true , true , true , true } ; int plan [10] ; void dfs ( int k ) { if ( k == num ) { for ( int i = 1 ; i < num ; i ++ ) { cout << pl [i] ; } for ( int i = 1 ; i <= num ; i ++ ) { if ( isn [i] ) { cout << i ; } } cout << endl ; cnt ++ ; } for ( int i = 1 ; i <= num ; i ++ ) { if ( isn [i] ) { isn [i] = false ; pl [k] = 1 ; dfs ( k + 1 ) ; pl [k] = 0 ; isn [i] = true ; } } return 0 ; } int mian ( ) { cin >> num ; dfs ( 1 , 1 ) ; cout << cnt << endl ; }