前缀和
文章平均质量分 64
是小张张呀 zsy
这个作者很懒,什么都没留下…
展开
-
差分(一维,二维,三维) 蓝桥杯三体攻击
如果一维二维已经没问题的可直接跳转*三维查分一维差分首先给定一个原数组a:a[1], a[2], a[3], a[n];然后我们构造一个数组b : b[1] ,b[2] , b[3], b[i];使得 a[i] = b[1] + b[2 ]+ b[3] +, + b[i]a数组是b数组的前缀和数组,反过来我们把b数组叫做a数组的差分数组。考虑构造差分b数组最为直接的方法如下:a[0 ]= 0;b[1] = a[1] - a[0];b[2] = a[2] - a[1];b[3] =a原创 2022-03-02 14:46:36 · 440 阅读 · 0 评论 -
HDU-6025-Coprime Sequence(女生赛)
Coprime SequenceDo you know what is called "Coprime Sequence’’? That is a sequence consists of nn positive integers, and the GCD (Greatest Common Divisor) of them is equal to 1."Coprime Sequence’’ is easy to find because of its restriction. But we can try原创 2021-10-29 14:18:11 · 68 阅读 · 0 评论 -
B - 代码派对(女生赛)
B - 代码派对Sample Input233 1 3 11 1 2 32 1 3 251 1 4 52 1 3 22 2 3 34 5 4 51 2 2 4Sample Output04//现在时刻,2021年10月28号00:38我终于ac了,,,,呜呜呜呜/*解题思路利用差分和二维前缀和求出每个格子上覆盖的区间数g[i][j]。如果这个时候求C(g[i][j],3)的和,那么会产生很多的重复,因为同样的三个区间可以覆盖多个格子。所以我们只保留覆盖区域左上原创 2021-10-28 00:47:23 · 173 阅读 · 1 评论