这个题我觉得题意给你很明显了,就是让你判断这一个改变之后如何让前面和后面接上,熟悉的朋友很容易感觉出这个经典问题,最大值不断变化的值要是在一个数轴上画图像的话,是一个阶梯的形状,所以这个点抬高或降低就有很直观的影响了。 1.对于这个点被降低:如果这个点不在阶梯的转角上,那么这个点没有任何意义,答案不 ...
分类:
其他好文 时间:
2019-10-02 00:20:26
阅读次数:
102
题意:给定一棵树,求树上所有点到其最远点的距离。 数据范围: 1 <= N <= 100000 我是分割线 题解:对于每个节点u来说,其可能到达的最长距离为max{其子树内的最长距离,其父节点不经过u的子树内的最长距离}。于是,我们便可以在第一遍dfs中预处理节点x到其子树内的最长距离,顺带求一下次 ...
分类:
其他好文 时间:
2019-10-01 18:37:17
阅读次数:
104
题意 : 长度不超过L,只由小写字母组成的,至少包含一个词根的单词,一共可能有多少个呢?这里就不考虑单词是否有实际意义。 比如一共有2个词根 aa 和 ab ,则可能存在104个长度不超过3的单词,分别为(2个) aa,ab, (26个)aaa,aab,aac...aaz, (26个)aba,abb ...
分类:
其他好文 时间:
2019-10-01 15:48:04
阅读次数:
89
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6740 中文题意链接:http://acm.hdu.edu.cn/contests/contest_showproblem.php?pid=1010&cid=872 题解:反向用next数组求循环节(前i ...
分类:
其他好文 时间:
2019-09-30 18:22:20
阅读次数:
106
曾经,Lele和他姐姐最喜欢,玩得最久的游戏就是俄罗斯方块(Tetris)了。 渐渐得,Lele发觉,玩这个游戏只需要手快而已,几乎不用经过大脑思考。 所以,Lele想出一个新的玩法。 Lele和姐姐先拿出一块长方形的棋盘,这个棋盘有些格子是不可用的,剩下的都是可用的。Lele和姐姐拿出俄罗斯方块里 ...
分类:
其他好文 时间:
2019-09-30 15:04:16
阅读次数:
95
The contest’s message distribution is a big thing in prepare. Assuming N students stand in a row, from the row-head start transmit message, each perso ...
分类:
其他好文 时间:
2019-09-30 14:58:16
阅读次数:
101
Friend HDU - 1719 Friend number are defined recursively as follows. (1) numbers 1 and 2 are friend number; (2) if a and b are friend numbers, so is ab ...
分类:
其他好文 时间:
2019-09-30 14:40:25
阅读次数:
114
Problem DescriptionIn many applications very large integers numbers are required. Some of these applications are using keys for secure transmission of ...
分类:
其他好文 时间:
2019-09-29 23:35:48
阅读次数:
121
Problem DescriptionI have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B. InputThe first line of ...
分类:
其他好文 时间:
2019-09-29 23:23:17
阅读次数:
100
题:http://acm.hdu.edu.cn/showproblem.php?pid=6736 题意:删掉一些边使得图不存在点双,求方案数。 分析:若一条边不属于点双,那么这条边有删和不删俩种选择,若找到点双,点双中必须删掉一条边(题目有保证一条边只能属于一个点双,所以不用担心一条边用于多个点双) ...
分类:
其他好文 时间:
2019-09-29 21:37:40
阅读次数:
93