提交时间:2023-11-25 08:55:09

运行 ID: 111911

# include <iostream> using namespace std ; int a [105] [105] ; int dp [105] [105] = { ( 0 , 0 ) , ( 0 , 1 ) } ; int main ( ) { int n , m ; cin >> n >> m ; for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = 1 ; j <= m ; j ++ ) { cin >> a [i] [j] ; } } for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = 1 ; j <= m ; j ++ ) { if ( a [i] [j] == 0 ) { dp [i] [j] = dp [i - 1] [j] + dp [i] [j - 1] ; } else { dp [i] [j] = 0 ; } } } cout << dp [n] [m] << endl ; return 0 ; }