上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 44 下一页
摘要: https://www.luogu.com.cn/problemnew/solution/P3375 1 #include<bits/stdc++.h> 2 using namespace std; 3 const int maxn=1e6+10; 4 int kmp[maxn]; 5 char a 阅读全文
posted @ 2020-02-03 10:38 古比 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 一、差分数组的定义及用途 1.定义: 对于已知有n个元素的离线数列d,我们可以建立记录它每项与前一项差值的差分数组f:显然,f[1]=d[1]-0=d[1];对于整数i∈[2,n],我们让f[i]=d[i]-d[i-1]。 2.简单性质: (1)计算数列各项的值:观察d[2]=f[1]+f[2]=d 阅读全文
posted @ 2020-02-02 17:52 古比 阅读(329) 评论(0) 推荐(0) 编辑
摘要: https://codeforces.com/contest/1181/problem/B 1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 string cal(string a,string b) 阅读全文
posted @ 2020-01-30 16:01 古比 阅读(121) 评论(0) 推荐(0) 编辑
摘要: https://codeforces.com/contest/1295/problem/D 不理解为啥这样做 1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 const int N=1e6+10; 阅读全文
posted @ 2020-01-30 14:23 古比 阅读(109) 评论(0) 推荐(0) 编辑
摘要: https://codeforces.com/contest/1180/problem/E 转载自他人博客 题意:有nn个菜肴,有mm个小朋友,每个菜肴的价格为aiai,每个小朋友有bibi元钱,小朋友从1→m1→m依次购买菜肴,当第ii个小朋友轮到的时候,他会购买他买的起的最贵的,否则就离开。要求 阅读全文
posted @ 2020-01-29 17:59 古比 阅读(181) 评论(0) 推荐(0) 编辑
摘要: F. Three Paths on a Tree time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a 阅读全文
posted @ 2020-01-26 21:02 古比 阅读(249) 评论(0) 推荐(0) 编辑
摘要: 二维前缀和 给你一个n*n的矩阵,里面有两种字符,‘W’和‘B’,代表black 和white 。其实这个矩阵就是一个方形画板,你有一个k*k的橡皮只能用一次,使k*k的矩阵里的B变成W,问完全空白的行和列的总数? 思路: 用1代替B,0代替W,然后维护一个前缀和数组,看能否用一个橡皮的操作使这一列 阅读全文
posted @ 2020-01-19 14:14 古比 阅读(192) 评论(0) 推荐(0) 编辑
摘要: https://codeforces.com/contest/1236/problem/E 阅读全文
posted @ 2020-01-17 12:58 古比 阅读(96) 评论(0) 推荐(0) 编辑
摘要: 题意:给出n个人(n是奇数),s钱;s为总的可以付工钱的钱; 每一个工人有一个付工钱的区间,只要在这个区间范围内,随便一个数都可以当作给这个工人付了钱; 老板要付给每个工人钱,并且付钱的中位数要尽可能大; 问:最大的中位数是多少; 思路:贪心+思维+二分; 我们以中位数为主体进行二分。那么就需要n/ 阅读全文
posted @ 2020-01-16 21:16 古比 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 1 #include<bits/stdc++.h> 2 using namespace std; 3 const int maxn=1e5+10; 4 int a[maxn]; 5 int b[maxn]; 6 int main() 7 { 8 int n; 9 scanf("%d",&n); 10 阅读全文
posted @ 2020-01-14 17:52 古比 阅读(373) 评论(0) 推荐(0) 编辑
上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 44 下一页