提交时间:2023-11-25 08:24:10

运行 ID: 111835

# include <iostream> using namespace std ; int a [105] [105] ; long long cnt = 0 , n ; void dfs ( int x , int y ) { if ( x > 100 || y > 100 ) { return ; } if ( x == n && y == n ) { cnt ++ ; return ; } else if ( x < n && y < n ) { if ( a [x + 1] [y] == 0 ) { dfs ( x + 1 , y ) ; } if ( a [x] [y + 1] == 0 ) { 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 ; }