提交时间:2023-11-25 08:33:29
运行 ID: 111864
#include<iostream> using namespace std; typedef long long ll; ll n, m, f[110][110]; bool a[110][110]; int main(){ cin >> m >> n; 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]){ f[i][j] = min(f[i][j-1], f[i-1][j]) + 1; } cout << f[n][m]; return 0; }