【Loj #10012. 「一本通 1.2 例 2」Best Cow Fences】题解
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15669626.html 题目链接 题目 给定一个长度为 nnn 的非负整数序列 AAA ,求一个平均数最大的,长度不小于 LLL 的子段。 思路 先二分平均值。 然后是判断。 如何判断一段数中是否存在长度大于等于 LLL 且平均值大于某个数的子段呢? 我们可以先让序列中的数都减去二分中的值,然后就转化为: 序列中是否存在长度大于等于 LLL 的字段和为正。 我们可以先构造一个前缀和。 假设我们当前算到序列中的第 iii 项,我们只需要在前 i−...
【SSOJ2625: 哪些路不能修】题解
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15669522.html 题目 一个有n个景点(入口)、m条单向道路的旅游胜地,单向是不友好的,因为这会让游客走很多冤枉路,而且从同一个入口出发,往不同方向走,能游玩的景点数目可能不同。于是,善良的Bob决定将道路全部改造成双向的,让每一个入口能逛的景点数量都确定下来,并制作景点数目表,让游客清楚地知道各个入口的景点数。但是,如果全部改成双向边之后,还需要修路,就可能导致景点数目表不正确。如果要景点数目表正确,请问哪些路是不能修的? 思路 这题的...
【Loj #10011. 「一本通 1.2 例 1」愤怒的牛】题解
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15669383.html 题目链接 题目 农夫约翰建造了一座有 间牛舍的小屋,牛舍排在一条直线上,第 间牛舍在 的位置,但是约翰的 头牛对小屋很不满意,因此经常互相攻击。约翰为了防止牛之间互相伤害,因此决定把每头牛都放在离其它牛尽可能远的牛舍。也就是要最大化最近的两头牛之间的距离。 牛们并不喜欢这种布局,而且几头牛放在一个隔间里,它们就要发生争斗。为了不让牛互相伤害。John 决定自己给牛分配隔间,使任意两头牛之间的最小距离尽可能的大,那么,这个...
2021.12.4上课题目内容回顾
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15669038.html 完成情况:(7/9) cf1110e 题目链接 我要是在noip前做这道题就好了。 这道题的本质就是noip2021方差中的一个性质,对于每个数进行修改,就是把它左右的差进行交换。 注意的是首项一定要一样。 Code 123456789101112131415161718192021222324252627282930313233343536373839// Problem: CF1110E Magic Stones//...
【CF577B Modulo Sum】题解
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15664786.html 题目链接 题目 You are given a sequence of numbers a1, a2, …, an, and a number m. Check if it is possible to choose a non-empty subsequence aij such that the sum of numbers in this subsequence is divisible by m. 给出 111 ...
【HDU 7015 Another String】题解
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15663221.html 题目链接 题目 Define the distance between two strings of the same length as the numbers of the positions where the characters differ in these two strings. If two strings of the same length has a distance of no more tha...
【HDU 5550 Game Rooms】题解
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15662976.html 题目链接 题目 Your company has just constructed a new skyscraper, but you just noticed a terrible problem: there is only space to put one game room on each floor! The game rooms have not been furnished yet, so you can ...
【HDU 5794 A Simple Chess】题解
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15659222.html 题目链接 题目 There is a n×m board, a chess want to go to the position (n,m) from the position (1,1). The chess is able to go to position (x2,y2) from the position (x1,y1), only and if only x1,y1,x2,y2 is satisfied tha...
卢卡斯定理Lucas 定理小结
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15657340.html Lacus 求: Cmn mod p\Large C_m^n~mod ~p Cmn mod p 则: Cmn mod p=Cmpnp×Cm mod pn mod p mod p\Large C_m^n~mod~p=C_{\frac{m}{p}}^{\frac{n}{p}} \times C_{m~mod~p}^{n~mod~p}~mod~p Cmn mod p=Cpmpn×Cm mod pn mod p mo...
【UVA12235 Help Bubu 】题解
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15652046.html 题目链接 题目 Bubu’s bookshelf is in a mess! Help him! There are nbooks on his bookshelf. We define the mess value to be the number of segments of consecutive equal-height books. For example, if the book heights are 30...











