Codeforces Round #130 (Div. 2)
A. Dubstep
- 字符串模拟。
- string.find()用法
string str;
size_t pos = str.find("WUB"); // 返回匹配的第一个位置
size_t nxt = str.find("WUB", pos); // 返回大于等于pos的第一个匹配位置
// 如果没有找到,则返回std::string::npos
B. Solitaire
- \(dp(i,j,k)\)表示是否能到达倒三张牌分别为\(i,j,k\)的状态。
C. Police Station
- 对于每个点处理出到1和n的最短距离以及对应的方案数。
- 若把警察局放置在点\(u\),根据最短距离可以计算出经过点\(u\)的路径条数,并且每条路径上被覆盖的边为2。
- 点1、点n需要特殊判断。
D. Prizes, Prizes, more Prizes
- 模拟题意做即可。
E. Blood Cousins
- 对于每个询问\(v_i, p_i\),先求出祖先\(u\),那么询问相当于求在子树\(u\)中,深度为\(dep[v_i]\)的点数,按照dfs序继续将问题转化成区间\([l,r]\)值为\(dep[v_i]\)的个数,这个离线分块做即可。
Codeforces Round #130 (Div. 2)的更多相关文章
- Codeforces Round #130 (Div. 2) C. Police Station
题目链接:http://codeforces.com/contest/208/problem/C 思路:题目要求的是经过1~N的最短路上的某个点的路径数 / 最短路的条数的最大值.一开始我是用spf ...
- Codeforces Round #130 (Div. 2) C - Police Station 最短路+dp
题目链接: http://codeforces.com/problemset/problem/208/C C. Police Station time limit per test:2 seconds ...
- Codeforces Round #130 (Div. 2) A. Dubstep
题目链接: http://codeforces.com/problemset/problem/208/A A. Dubstep time limit per test:2 secondsmemory ...
- Codeforces Round #580 (Div. 1)
Codeforces Round #580 (Div. 1) https://codeforces.com/contest/1205 A. Almost Equal 随便构造一下吧...太水了不说了, ...
- Codeforces Round #366 (Div. 2) ABC
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...
- Codeforces Round #354 (Div. 2) ABCD
Codeforces Round #354 (Div. 2) Problems # Name A Nicholas and Permutation standard input/out ...
- Codeforces Round #368 (Div. 2)
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...
- cf之路,1,Codeforces Round #345 (Div. 2)
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... ...
- Codeforces Round #279 (Div. 2) ABCDE
Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems # Name A Team Olympiad standard input/outpu ...
随机推荐
- Spring中的Jdbc事务管理
Spring提供了对事务的声明式事务管理,只需要在配置文件中做一些配置,即可把操作纳入到事务管理当中,解除了和代码的耦合. Spring声明式事务管理,核心实现就是基于Aop. Spring声明式事务 ...
- struts中获取域
在struts的Action中,有三种方法可以得到request.session.servletContext域. 1.通过ServletActionContext类获取对象 HttpServletR ...
- 踏着前人的脚印学Hadoop——序列化,Writerable
package org.apache.hadoop.io; import java.io.DataOutput;import java.io.DataInput;import java.io.IOEx ...
- 使用generator自动生成mybatis model、mapper.xml、mapper等(转)
原文链接:http://www.cnblogs.com/lichenwei/p/4145696.html Mybatis属于半自动ORM,在使用这个框架中,工作量最大的就是书写Mapping的映射文件 ...
- IOS弹出视图 LewPopupViewController
LewPopupViewController是一款IOS弹出视图软件.iOS 下的弹出视图.支持iPhone/iPad. 软件截图 使用方法 弹出视图 1 2 3 4 5 PopupView *vie ...
- C#特性
一.概念:C#的特性也是一个类,继承自System.Attribute,用于描述类.方法.字段等 二.类型: 2.1 .net中特性用来处理多种问题,比如序列化.程序的安全特性.防止即时编译器对 ...
- 一个基于atomic的卖票测试
package testAtomic; import java.util.concurrent.atomic.AtomicInteger; import sun.security.krb5.inter ...
- JS 原型继承的几种方法
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 一些需要注意的C知识点
1.数组在作为参数传递到函数时,会退化为一个指针.也就是说,一旦进入函数内部,数组已经变为了一个指针.其实是在参数传递的时候进行了浅拷贝,编译器会声明一个指针指向该数组,在函数内部所有的操作都是对该临 ...
- GridView导出Excel
public void OUTEXCEL() { DataSet ds = new GW_T_DemandDAL().GetWzH(GetPersonInfoData(UserInfo), Reque ...