0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-13 14:06:27 +00:00
OI-codes/Luogu/P1359/P1359.cpp

23 lines
457 B
C++
Raw Normal View History

2020-11-03 23:34:05 +00:00
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, t, a[205][205], f[205];
cin >> n;
for (int i = 1; i <= n; i++) {
for (int j = i + 1; j <= n; j++) {
cin >> a[i][j];
}
f[i] = 0x3f3f3f;
}
f[n] = 0;
2021-11-19 09:01:13 +00:00
for (int i = n - 1; i >= 0; i--) {
2020-11-03 23:34:05 +00:00
for (int j = i + 1; j <= n; j++) {
f[i] = min(f[i], f[j] + a[i][j]);
}
}
cout << f[1] << endl;
return 0;
}