include [HTML_REMOVED]
using namespace std;
const int C = 105;
int n, m;
int v[C], w[C];
int l[C], r[C];
int bigson[C];
int f[C][C];
int dfs(int i, int j) {
if (f[i][j] || i == 0 || j == 0) return f[i][j];
f[i][j] = dfs(r[i], j);
for (int k = 0; k <= j - v[i]; k ++)
f[i][j] = max(f[i][j], dfs(l[i], j-v[i] - k)+ dfs(r[i], k) + w[i]);
return f[i][j];
}
大家加油!!!