上一页 1 2 3 4 5 6 ··· 16 下一页
摘要: Codeforces Round #638 (Div. 2) B. Phoenix and Beauty 正确解法: n个数分别为ai,往里面任意加数(正数)使连续k个字串的和都相同。 如果n个数里面出现数的次数大于k,那么就不能成立。 如果n个数里面出现的数等于k,把这些数按一定顺序输出n次就可。 阅读全文
posted @ 2020-05-23 17:30 kaike 阅读(189) 评论(0) 推荐(0) 编辑
摘要: A.收集纸片 Description 链接:https://ac.nowcoder.com/acm/contest/5713/A来源:牛客网 我们把房间按照笛卡尔坐标系进行建模之后,每个点就有了一个坐标。 假设现在房子里有些纸片需要被收集,收集完纸片你还要回归到原来的位置,你需要制定一个策略来使得自 阅读全文
posted @ 2020-05-19 20:59 kaike 阅读(170) 评论(0) 推荐(0) 编辑
摘要: E. Restorer Distance Description You have to restore the wall. The wall consists of NN pillars of bricks, the height of the ii-th pillar is initially 阅读全文
posted @ 2020-05-19 18:56 kaike 阅读(336) 评论(0) 推荐(0) 编辑
摘要: 1 for(int i=1;i<=n;i++) 2 { 3 if(s[i]=='x') 4 { 5 dp3=min(dp2,dp3+1); 6 dp2=min(dp1,dp2+1); 7 dp1++; 8 } 9 else 10 { 11 dp5=min(dp4,dp5+1); 12 dp4=min 阅读全文
posted @ 2020-05-18 20:55 kaike 阅读(214) 评论(0) 推荐(0) 编辑
摘要: LCA(least common ancestors)最近公共祖先 指的就是对于一棵有根树,若结点z既是x的祖先,也是y的祖先(不要告诉我你不知道什么是祖先),那么z就是结点x和y的最近公共祖先。 定义到此。 那么怎么求LCA? 对于朴素思想,就是我要一步一步往上爬。。一步一步走。先把结点x和y整到 阅读全文
posted @ 2020-02-15 17:45 kaike 阅读(416) 评论(0) 推荐(0) 编辑
摘要: F. Three Paths on a Tree Description You are given an unweighted tree with nn vertices. Recall that a tree is a connected undirected graph without cyc 阅读全文
posted @ 2020-02-13 02:37 kaike 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 转载:数位dp总结 之 从入门到模板 基础篇 数位dp是一种计数用的dp,一般就是要统计一个区间[le,ri]内满足一些条件数的个数。所谓数位dp,字面意思就是在数位上进行dp咯。数位还算是比较好听的名字,数位的含义:一个数有个位、十位、百位、千位......数的每一位就是数位啦!之所以要引入数位的 阅读全文
posted @ 2019-11-05 20:29 kaike 阅读(363) 评论(0) 推荐(0) 编辑
摘要: KMP未优化: #include <iostream> #include <string> using namespace std; /* P 为模式串,下标从 0 开始 */ void GetNext(string P, int next[]) { int p_len = P.size(); in 阅读全文
posted @ 2019-10-16 16:23 kaike 阅读(111) 评论(0) 推荐(0) 编辑
摘要: Codeforces Round #271 (Div. 2) E待填坑 1 #include <iostream> 2 #include <cstdio> 3 #include 4 #include <cstring> 5 #include <vector> 6 using namespace st 阅读全文
posted @ 2019-10-05 15:59 kaike 阅读(113) 评论(0) 推荐(0) 编辑
摘要: D. Distinct Characters Queries Description You are given a string ss consisting of lowercase Latin letters and qq queries for this string. Recall that 阅读全文
posted @ 2019-10-02 13:51 kaike 阅读(450) 评论(0) 推荐(1) 编辑
上一页 1 2 3 4 5 6 ··· 16 下一页