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

运行 ID: 111845

#include<iostream> using namespace std; typedef long long ll; ll n, f[110][110]; bool a[110][110]; int main(){ cin >> n; for(int i = 1; i <= n; i++) for(int j = 1; j <= n; j++) cin >> a[i][j]; for(int i = 1; i <= n; i++) for(int j = 1; j <= n; j++) if(!a[i][j]){ f[i][j] = min(f[i][j-1], f[i-1][j]) + 1; } cout << f[n][n]; return 0; }