![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
前缀和
wtcl
这个作者很懒,什么都没留下…
展开
-
Hard Process(二分+前缀和)
1.求最值问题考虑二分2.一维数组多想想前缀和3.一维数组区间问题可以考虑双指针(尺取):枚举右端点,求左端点代码:#include<cstdio>#include<cstring>#include<iostream>#include<algorithm>using namespace std;int a[1000001],sum[1000001];int n,k;bool check(int x){ for(int i=1;i+x-原创 2020-07-05 20:31:43 · 252 阅读 · 0 评论 -
Codeforces Round #634 (Div. 3) E2. Three Blocks Palindrome (hard version) (前缀和)
在看到这些数据范围比较小的数的时候一般是一些比较暴力的算法这道题的数的大小不超过200 可以考虑枚举。思路:先枚举第一段的数和长度,第三段也就确定了。然后再查找(l,r)之间哪个数个数最多。#include<cstdio>#include<cstring>#include<iostream>#include<algorithm>#in...原创 2020-04-15 10:24:52 · 92 阅读 · 0 评论 -
Codeforces 1333C - Eugene and an array(前缀和 计数)
讲解:https://www.cnblogs.com/stelayuri/p/12664224.html原创 2020-04-09 09:53:58 · 144 阅读 · 0 评论