提交时间:2023-11-25 09:26:47
运行 ID: 111960
#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; }