【USACO2021 Walking Home 】题解
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15716395.html 题目 Bessie the cow is trying to walk from her favorite pasture back to her barn. The pasture and farm are on an N×N grid (2≤N≤50 ), with her pasture in the top-left corner and the barn in the bottom-right corner. ...
【USACO2021 Air Cownditioning】题解
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15716347.html 题目 Farmer John’s cows N are very particular about the room temperature in their barn. Some cows like the temperature to be on the cooler side, while others prefer more warmth. Farmer John’s barn contains a sequen...
【USACO2021 Lonely Photo】题解
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15716312.html 题目 Farmer John has recently acquired N new cows (3≤N≤5×105), each of whose breed is either Guernsey or Holstein. The cows are currently standing in a line, and Farmer John wants take a photo of every sequence of ...
【CF2A Winner】题解
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15712426.html 题目链接 题目 The winner of the card game popular in Berland “Berlogging” is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the ...
二分三分小结
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15704448.html 二分 对于一个存在单调性的函数,我们要枚举满足条件的最小/最大值,我们通过枚举中间值缩小范围来定位。 123456while(l<r){ mid=(l+r+1)>>1; if(check(mid)) l=mid; else r=mid-1; } 三分 对于一个存在单峰/单谷性的函数,我们可以通过枚举两个端点通过比较大小缩小范围求出峰顶/谷底。 1234567while(r-l&g...
【P1025 [NOIP2001 提高组] 数的划分】题解
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15704434.html 题目链接 题目 将整数 nnn 分成 kkk 份,且每份不能为空,任意两个方案不相同(不考虑顺序)。 例如:n=7n=7n=7,k=3k=3k=3,下面三种分法被认为是相同的。 1,1,51,1,51,1,5; 1,5,11,5,11,5,1; 5,1,15,1,15,1,1. 问有多少种不同的分法。 思路 首先我们可以打出一个暴力。然而为了防止重复,我们可以规定每次枚举出的这个数要大于等于上一个数。 然后只有40分。 ...
【[AGC019F] Yes or No】题解
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15699367.html 题目链接 题目 有 N+MN+MN+M 个问题,其中有 NNN 个问题的答案是 YES,MMM 个问题的答案是 NO。当你回答一个问题之后,会知道这个问题的答案,求最优策略下期望对多少。 答案对 998244353998244353998244353 取模。 思路 首先假设撇开算期望,就一个贪心,如果 n>mn>mn>m,我们就会不断答yes,然后至少答对 nnn 题。 于是总的来说,至少答对 max...
【AGC001E E - BBQ Hard】 题解
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15694554.html 题目链接 题目 Snuke is having another barbeque party. This time, he will make one serving of Skewer Meal. He has a stock of N Skewer Meal Packs. The i-th Skewer Meal Pack contains one skewer, Ai pieces of beef and Bi...
【P2571 [SCOI2010]传送带】题解
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15693858.html 题目链接 题目 在一个 222 维平面上有两条传送带,每一条传送带可以看成是一条线段。两条传送带分别为线段 AB\text{AB}AB 和线段 CD\text{CD}CD。lxhgww 在 AB\text{AB}AB 上的移动速度为 PPP,在 CD\text{CD}CD 上的移动速度为 QQQ,在平面上的移动速度 RRR。现在 lxhgww 想从 A\text AA 点走到 D\text DD 点,他想知道最少需要走多...
组合数学常用公式
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15690256.html 组合数学的推式子题公式基本上都有了 ∑i=0nCni=2n\Large\sum_{i=0}^nC_n^i=2^n i=0∑nCni=2n ∑i=0nCni(−1)i=0\Large\sum_{i=0}^nC_n^i(-1)^i=0 i=0∑nCni(−1)i=0 ∑i=0nCnixi=(1+x)n\Large\sum_{i=0}^nC_n^ix^i=(1+x)^n i=0∑nCnixi=(1+x)n CnkC...





![【[AGC019F] Yes or No】题解](/page_img/p10.png)

![【P2571 [SCOI2010]传送带】题解](/page_img/p8.png)





