#include <stdio.h>
#include <stdlib.h>
int p[200][200];
#define min(a, b) (a < b ? a:b )
int main() {
int n;
scanf("%d", &n);
for (int i = 0; i < n-1; i++) {
for (int j = i+1; j<n; j++) {
scanf("%d", &p[i][j]);
}
}
for (int r = 2; r <n; r++) {
for (int i = 0; i < n-r; i++) {
int j = i +r;
for (int k = i+1; k <j; k++) {
p[i][j] = min(p[i][j], p[i][k] +p[k][j]);
}
}
printf("%d", p[0][n-1]);
}
return 0;
}
租用游艇问题
最新推荐文章于 2024-10-12 22:09:36 发布