摘要:
Problem Description In some country there are exactly n cities and m bidirectional roads connecting the cities. Cities are numb... 阅读全文
posted @ 2022-09-20 23:00
老程序员111
阅读(26)
评论(0)
推荐(0)
摘要:
Problem Description Students in a class are making towers of blocks. Each student makes a (non-zero) tower by stacking pieces l... 阅读全文
posted @ 2022-09-20 23:00
老程序员111
阅读(39)
评论(0)
推荐(0)
摘要:
Problem Description Given a tree (a connected graph with no cycles), you have to find the farthest nodes in the tree. The edges... 阅读全文
posted @ 2022-09-20 23:00
老程序员111
阅读(27)
评论(0)
推荐(0)
摘要:
【定义】 给定一棵树,树中的每条边都有一个权值。 树中两点的距离:连接两点的路径边权之和树的直径:树中最远的两个节点之间的距离树的最长链:连接树中最远的两个结点的路径【实现】 树的直径通常有两种求法,时间复杂度均为O(n)。 假设树以 n 个点 n-1 条边的... 阅读全文
posted @ 2022-09-20 23:00
老程序员111
阅读(97)
评论(0)
推荐(0)
摘要:
Problem Description Nura wants to buy k gadgets. She has only s burles for that. She can buy each gadget for dollars or for pou... 阅读全文
posted @ 2022-09-20 23:00
老程序员111
阅读(30)
评论(0)
推荐(0)
摘要:
Problem Description Lavrenty, a baker, is going to make several buns with stuffings and sell them. Lavrenty has n grams of dou... 阅读全文
posted @ 2022-09-20 23:00
老程序员111
阅读(290)
评论(0)
推荐(0)
摘要:
Problem Description 小度熊拿到了一个无序的数组,对于这个数组,小度熊想知道是否能找到一个k 的区间,里面的 k 个数字排完序后是连续的。 现在小度熊增加题目难度,他不想知道是否有这样的 k 的区间,而是想知道有几个这样的 k 的区间... 阅读全文
posted @ 2022-09-20 23:00
老程序员111
阅读(24)
评论(0)
推荐(0)
摘要:
Problem Description There is a tree(the tree is a connected graph which contains n points and n−1 edges),the points are labeled... 阅读全文
posted @ 2022-09-20 23:00
老程序员111
阅读(52)
评论(0)
推荐(0)
摘要:
Problem Description After awarded lands to ACMers, the queen want to choose a city be her capital. This is an important event i... 阅读全文
posted @ 2022-09-20 23:00
老程序员111
阅读(34)
评论(0)
推荐(0)
摘要:
【概述】 最小树形图,就是给出一个带权有向图,从中指定一个特殊的结点 root,求一棵以 root 为根的有向生成树 T,且使得 T 中所有边权值最小。 简单来说,最小树形图就是有向图的最小生成树。 【朱刘算法】 1.过程 简单来说,朱刘算法分为四个过程: 1... 阅读全文
posted @ 2022-09-20 23:00
老程序员111
阅读(301)
评论(0)
推荐(0)

浙公网安备 33010602011771号