随笔分类 - ACM / 动态规划 / 线性DP
摘要:题目链接:导弹拦截 思路 代码 #include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int a[N], x, l, dp[N], maxn; int g[N], cnt; int main() { while (c
阅读全文
摘要:题目链接:数字三角形 思路 dp:金字塔顶的元素为起点,金字塔每行的最左侧数字只能从上一层的最左侧数字到达,如7 -> 3 -> 8 -> 2 -> 4,这些数字中的每一个(除起点7外)都只能从上一层的最左侧数字到达,递推公式为dp[i][1] = max(dp[i][1], num[i][1] +
阅读全文

浙公网安备 33010602011771号