摘要: 最小生成树Prim算法的简单变形,Prim算法就是贪心的思想,从任一点开始,依次选择离已知点最近的点扩展,那么这题只要初始的时候把给出的两点加到已知点中即可。/* * hdu4463/win.cpp * Created on: 2012-11-17 * Author : ben */#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <ctime>#include <iostream>#include <algor 阅读全文
posted @ 2012-11-17 20:00 moonbay 阅读(309) 评论(0) 推荐(0) 编辑
摘要: 挺水的动态规划,只要依次枚举子树的个数即可。/* * hdu4472/win.cpp * Created on: 2012-11-17 * Author : ben */#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <ctime>#include <iostream>#include <algorithm>#include <queue>#include <set>#includ 阅读全文
posted @ 2012-11-17 18:38 moonbay 阅读(727) 评论(0) 推荐(1) 编辑