_what

博客园 首页 新随笔 联系 订阅 管理

2020年4月12日 #

摘要: 先开始没有res.push_back(v);导致少了[] 另 : 比78.子集 多一条判断条件 阅读全文
posted @ 2020-04-12 10:17 _what 阅读(147) 评论(0) 推荐(0) 编辑

摘要: 递归 阅读全文
posted @ 2020-04-12 09:59 _what 阅读(186) 评论(0) 推荐(0) 编辑

2020年1月22日 #

摘要: B. The Number of Products 递推:ne[i]表示以ai结尾的负区间个数,po[i]表示以ai结尾的负区间个数 阅读全文
posted @ 2020-01-22 19:05 _what 阅读(135) 评论(0) 推荐(0) 编辑

2020年1月16日 #

摘要: 本题题意很好读,看上去也不难写 写完运行才发现输出title只有一个单词... 后来把cin t换成了getline(cin, t) 还有一个坑点: Line 1: the 7 digit ID number; 故输出要用%07d 采用的数据结构是map 开了很多这样的map 还有key的读入,也需 阅读全文
posted @ 2020-01-16 20:30 _what 阅读(154) 评论(0) 推荐(0) 编辑

2020年1月15日 #

摘要: 银行窗口排队, N个窗口,黄线前每个窗口可以排M人, 已排队的人不能换队伍 黄线后的人没有站队 按照题意可知,黄线后的人在有人出队的时刻选择序号小的队伍开始排队 对于一个队伍来说,当黄线后还有没有入队的顾客时,每有一人到达服务结束时间,就会有一人入队 所以,我们可以确定每一队的成员编号、服务时间和顺 阅读全文
posted @ 2020-01-15 14:54 _what 阅读(147) 评论(0) 推荐(0) 编辑

2020年1月13日 #

摘要: 今天在热心网友的督促下完成了第一道PAT编程题。 太久没有保持训练了,整个人都很懵。 解题方法: 1.读懂题意 2.分析重点 3.确定算法 4.代码实现 该题需要计算每层的叶子节点个数,所以选用BFS 还有一个关键问题是 如何记录一层的开始和结束 另外,对于新手来说,图的存储也是一个知识点 容易忽略 阅读全文
posted @ 2020-01-13 22:17 _what 阅读(167) 评论(0) 推荐(0) 编辑

2019年10月21日 #

摘要: Trie树模板题 时隔几个月终于又get了Trie树好理解又简洁的模板 / / include include include include include include include include include include include include typedef long l 阅读全文
posted @ 2019-10-21 15:08 _what 阅读(136) 评论(1) 推荐(0) 编辑

2019年10月18日 #

摘要: 最近公共祖先二 离线算法 / / include include include include include include include include include include include include typedef long long LL; typedef unsigne 阅读全文
posted @ 2019-10-18 19:29 _what 阅读(135) 评论(1) 推荐(0) 编辑

摘要: LCA离线算法的应用:在带权树中求任意两点的距离。 "离线"是指求出答案之后保存起来,最后一起输出。(在一次遍历中把所有询问一次性解决。) Tarjan算法的基本步骤: 1.任选一个点作为根节点,从该点开始dfs遍历 2.遍历该点u的子树中所有节点,并标记这些点的被访问状态 3.如果v还有子树中的节 阅读全文
posted @ 2019-10-18 15:26 _what 阅读(132) 评论(0) 推荐(0) 编辑

2019年10月14日 #

摘要: ``` /**/ #include #include #include #include #include #include #include #include #include #include #include #include typedef long long LL; typedef unsigned long long ULL; using namespace std; bool Sqr 阅读全文
posted @ 2019-10-14 21:21 _what 阅读(140) 评论(0) 推荐(0) 编辑