社区讨论
为什么j不能从子树的长度开始计数
P2014[CTSC1997] 选课参与者 2已保存回复 3
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 3 条
- 当前快照
- 1 份
- 快照标识符
- @locw9rti
- 此快照首次捕获于
- 2023/10/30 20:46 2 年前
- 此快照最后确认于
- 2023/11/05 07:15 2 年前
CPP
void dp(int x)
{
int l=son[x].size();
for(int i=0;i<l;++i){
int y=son[x][i];
dp(y);
for(int t=m;t>=1;t--)
for(int j=t;j>=1;j--){
f[x][t]=max(f[x][t],f[x][t-j]+f[y][j]);
}
}
if(x!=0)
for(int t=m;t>0;t--)
f[x][t]=f[x][t-1]+c[x];
}
回复
共 3 条回复,欢迎继续交流。
正在加载回复...