依赖关系形成一棵树,要选子节点必先选择其父节点关键:把背包放在树上来做,也就是树上的01背包View Code #include<stdio.h>#include<string.h>#include<vector>using namespace std;struct node{ int v,next;}edge[10010];int head[110];int dp[110][110];int n,m,tot;void add(int s,int t){ edge[tot].v=t; edge[tot].next=head[s]; head[s]=tot++ Read More
posted @ 2011-12-12 20:42 Because Of You Views(524) Comments(0) Diggs(0) Edit