摘要: 题目描述 Problem Description 在讲述DP算法的时候,一个经典的例子就是数塔问题,它是这样描述的: 有如下所示的数塔,要求从顶层走到底层,若每一步只能走到相邻的结点,则经过的结点的数字之和最大是多少? 已经告诉你了,这是个DP的题目,你能AC吗? Input 输入数据首先包括一个整 阅读全文
posted @ 2022-02-24 23:54 Gustavo09 阅读(67) 评论(0) 推荐(0)
摘要: 并查集基本思想框架,使用数组bin[n]对于每一个地点进行标记性质编号,如果ABC三个城市可被串联,则他们的bin[A,B,C]都相同; 两个函数findx与merge:findx向上层层找出bin[],merge合并:将二者得bin[]改为相同。 findx函数: int findx(int x) 阅读全文
posted @ 2022-02-24 13:13 Gustavo09 阅读(56) 评论(0) 推荐(0)
摘要: Problem Description Wang Haiyang is a strong and optimistic Chinese youngster. Although born and brought up in the northern inland city Harbin, he has 阅读全文
posted @ 2022-02-24 11:51 Gustavo09 阅读(28) 评论(0) 推荐(0)