一波树上背包秒杀-- #include<cstdio> #include<cstring> #include<algorithm> #include<vector> #define REP(i, a, b) for(int i = (a); i < (b); i++) using namespace std; const int MAXN = 312; int f[MAXN][MAXN], cnt[MAXN], n, k; struct node{ i…
废话不多说,直接上题: 1580:加分二叉树 时间限制: 1000 ms 内存限制: 524288 KB提交数: 121 通过数: 91 [题目描述] 原题来自:NOIP 2003 设一个 n 个节点的二叉树 tree 的中序遍历为 (1,2,3,⋯,n),其中数字 1,2,3,⋯,n 为节点编号.每个节点都有一个分数(均为正整数),记第 i 个节点的分数为 di ,tree 及它的每个子树都有一个加分,任一棵子树 subtree(也包含 tree 本身)的加分计算方法如…