This commit is contained in:
HuangHai
2025-08-30 18:35:01 +08:00
commit 1f397eca87
6258 changed files with 1487241 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
#include <bits/stdc++.h>
using namespace std;
const int N = 110;
int n;
int w[N][N], f[N];
int main() {
cin >> n;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
cin >> w[i][j];
// 初始化为最大值
memset(f, 0x3f, sizeof f);
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++) {
if (i == 1 && j == 1)
f[j] = w[i][j];
else
f[j] = min(f[j], f[j - 1]) + w[i][j];
}
printf("%d\n", f[n]);
return 0;
}