1 2 3 4
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 20 下一页
摘要: https://ac.nowcoder.com/acm/contest/7413/B 神奇的题,公式可以看代码 已知n和m,ans = C(n,0)+C(n,1) .....C(n,m+1); 这个要分开看。 C(n,0)+C(n,1)+C(n,2)的含义为 长度为0,1,2的集合有这么多种排列方法 阅读全文
posted @ 2020-09-21 19:55 Lesning 阅读(214) 评论(0) 推荐(0)
摘要: https://codeforces.com/contest/1393/problem/D 矩阵dp,数有几个菱形,一般好像就是以某个位置为底,然后去dp 具体看代码吧,没啥可说的 ,都是玄学dp #include<iostream> #include<cstring> using namespac 阅读全文
posted @ 2020-09-19 10:23 Lesning 阅读(209) 评论(0) 推荐(0)
摘要: https://codeforces.com/contest/1400/problem/E 可以横着把有连续的数字-1,或者把某一个数字清0,问你最少操作几次,分治 555 555 555操作3次,1 1 1操作1次 具体看代码把 #include<iostream> #include<cstrin 阅读全文
posted @ 2020-09-17 16:40 Lesning 阅读(120) 评论(0) 推荐(0)
摘要: https://www.luogu.com.cn/problem/P3761 这是个神仙题,会卡常 题目让你改一条边把直径变得最短。 枚举每条边,会把图分成两个地方,两个连通块(x区和y区域)都换根dp一下,算出离x最远的点的距离记为dis【x】。然后枚举一下 新直径有三个来源 1 max dis[ 阅读全文
posted @ 2020-09-17 12:06 Lesning 阅读(168) 评论(0) 推荐(0)
摘要: https://codeforces.com/contest/1407/problem/E 玄学题,有一个重要的事情,反向建边,边指向的点颜色一致,那就从n开始bfs,第一次遇到必定要和边反色,因为不反色的话路就短了。。。(第一次遇到的路一定是最短的) 具体看代码,写法简单,参考LDK神仙 #inc 阅读全文
posted @ 2020-09-15 22:30 Lesning 阅读(143) 评论(0) 推荐(0)
摘要: https://codeforces.com/contest/1407/problem/D 这神仙题啊,举个例子 4 5 6 5 6 3 这样的序列如何建边? //先只考虑中间部分比i j大的 4 4 5 4 5 4 5 6 5 6 4 5 5 5 5 4 5 4 5 6 5 6 3 4 5 6 3 阅读全文
posted @ 2020-09-15 19:49 Lesning 阅读(170) 评论(0) 推荐(0)
摘要: https://ac.nowcoder.com/acm/contest/5671/H 这个题前导0是无所谓的 dp[pos][a][b][up][up2],pos 100(位置),a,b1000(a数字和b数字的和),up,up2(a是否达到N的上界,b是否达到a的上界) 3,会超时,需要优化 试想 阅读全文
posted @ 2020-09-12 09:47 Lesning 阅读(219) 评论(0) 推荐(0)
摘要: https://codeforces.com/contest/1405/problem/D 我是zz,看错题了,其实就两种可能 1.开局直接被抓住 disA >= dis(a,b) 2.逃跑,但是如何跑呢?我们发现,db >= 2*da + 1就能跑的了,因为db小的化迟早会被抓住,放风筝就好了,看 阅读全文
posted @ 2020-09-10 21:36 Lesning 阅读(193) 评论(0) 推荐(0)
摘要: https://www.luogu.com.cn/problem/P3413 回文长度2或者3就可以裁定,值得注意的是dp[pos][pre][ppre]可能应对3334321和5554321(都有321),所以要引入最新的变量才行。 dp[pos][pre][ppre][sum],具体套了板子,返 阅读全文
posted @ 2020-09-10 15:35 Lesning 阅读(121) 评论(0) 推荐(0)
摘要: https://www.luogu.com.cn/problem/P2602 挺简单 的其实,板子题 真实的模板 #include<bits/stdc++.h> using namespace std; typedef long long ll; int len,a[2000]; ll l,r,dp 阅读全文
posted @ 2020-09-09 21:17 Lesning 阅读(168) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 20 下一页