提交时间:2023-11-25 08:37:42
运行 ID: 111876
# include <iostream> using namespace std ; int a [105] [105] ; long long cnt = 0 , n ; void dfs ( int x , int y ) { if ( x >= n && y >= n ) { cout << "t" << endl ; cnt ++ ; return ; } else if ( x < n && y < n ) { if ( a [x + 1] [y] == 0 ) { cout << "r" << ' ' ; dfs ( x + 1 , y ) ; } if ( a [x] [y + 1] == 0 ) { cout << "d" << ' ' ; dfs ( x , y + 1 ) ; } } return ; } int main ( ) { cin >> n ; for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = 1 ; j <= n ; j ++ ) { cin >> a [i] [j] ; } } dfs ( 1 , 1 ) ; cout << cnt << endl ; return 0 ; }