2011年11月13日

树的dp

摘要: poj1694树的搜索问题题目解析:1.给定数的节点的编号,和它的子节点个数和标号,从树的底端节点向上遍历 2.在遍历过程中每个节点的子节点必须放上石子,才能向上继续遍历 3.将每个节点所需的石子数放在temp[]数组中,对其按降序进行排列,选出temp[i]+i的最大值,即为所需石子数。#include "iostream"#include "algorithm" using namespace std;int tree[201][201];bool cmp(const int a,const int b){ return a>b;}int DF 阅读全文

posted @ 2011-11-13 14:22 金乌载日 阅读(120) 评论(0) 推荐(0)

导航