【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...
【Poj 1191 棋盘分割】题解
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15646888.html 题目链接 题目 将一个8*8的棋盘进行如下分割:将原棋盘割下一块矩形棋盘并使剩下部分也是矩形,再将剩下的部分继续如此分割,这样割了(n-1)次后,连同最后剩下的矩形棋盘共有n块矩形棋盘。(每次切割都只能沿着棋盘格子的边进行) 原棋盘上每一格有一个分值,一块矩形棋盘的总分为其所含各格分值之和。现在需要把棋盘按上述规则分割成n块矩形棋盘,并使各矩形棋盘总分的均方差最小。 均方差,其中平均值,xi为第i块矩形棋盘的总分。 请...
【P4302 [SCOI2003]字符串折叠】题解
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15646276.html 题目链接 题目 折叠的定义如下: 一个字符串可以看成它自身的折叠。记作S = S X(S)是X(X>1)个S连接在一起的串的折叠。记作X(S) = SSSS…S(X个S)。 如果A = A’, B = B’,则AB = A’B’ 例如,因为3(A) = AAA, 2(B) = BB,所以3(A)C2(B) = AAACBB,而2(3(A)C)2(B) = AAACAAACBB 给一个字符串,求它的最短折叠。例...
贪心小结(一本通 1.1 口胡题解)
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15645806.html 本文章对一本通上题目来讲 题解基本上是口胡的,所以很简短。 「一本通 1.1 例 1」活动安排 按右端点排序后优先选右端点靠前的即可。 「一本通 1.1 例 2」种树 按右端点排序,对于每个区间差多少棵就在它尾部重多少棵,双指针维护一下。 「一本通 1.1 例 3」碰水装置 排除不行的后计算出左右端点,然后在满足覆盖左边的情况下贪心使右边最右即可。 「一本通 1.1 例 4」加工生产调度 考虑两个商品的情况作为快排依据,...
【P2512 [HAOI2008]糖果传递】题解
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15645706.html 题目链接 题目 有 nnn 个小朋友坐成一圈,每人有 aia_iai 个糖果。每人只能给左右两人传递糖果。每人每次传递一个糖果代价为 111。 思路 设 xix_ixi 表示第 iii 个人传给前一个人的糖果数,负数则是反向传。 可以列出方程,然后依次把 xix_ixi 用 x1x_1x1 表示出来,再设 ci=∑j=1i−1(aj−a‾)c_i=\sum_{j=1}^{i-1}(a_j-\overline a)...
【P1717 钓鱼】题解
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15645444.html 题目链接 题目 话说发源于小朋友精心设计的游戏被电脑组的童鞋们藐杀之后非常不爽,为了表示安慰和鼓励,VIP999 决定请他吃一次“年年大丰收”,为了表示诚意,他还决定亲自去钓鱼。 但是,因为还要准备 NOIP2013, z老师只给了他 HHH 个小时的空余时间,假设有 nnn 个鱼塘都在一条水平路边,从左边到右编号为 1, 2, 3 … n 。 VIP是个很讲究效率的孩子,他希望用这些时间钓到尽量多的鱼。他从湖1出发,向...






![【P4302 [SCOI2003]字符串折叠】题解](/page_img/p4.png)
![【P2512 [HAOI2008]糖果传递】题解](/page_img/p17.png)




