随笔分类 - 

摘要:题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=6446 题目给出的数据为一棵树,dfs扫描每条边,假设去掉某条边,则左边 x 个点,右边 n-x 个点,则经过该条边共有 x*(n-x) 种组合,又因为 1~n 全排列有 n! 种,故 a~b,包含 b~ 阅读全文
posted @ 2018-08-28 16:05 liubilan 阅读(175) 评论(0) 推荐(0) 编辑
摘要:题目地址:https://www.nowcoder.com/acm/contest/136/C dfs找出最长路和次长路,将两个结果相加再加上起点即可; 阅读全文
posted @ 2018-08-22 21:48 liubilan 阅读(189) 评论(0) 推荐(0) 编辑
摘要:题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=6349 Knowledge Point: 最小生成树算法Prim&Kruskal Summarize: 本题采用构造两颗带权最小生成树的方法求解; 求解最小生成树的方法有prim和kruskal两种方法, 阅读全文
posted @ 2018-08-07 21:42 liubilan 阅读(231) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示