Codeforces Round #135 (Div. 2)
A. k-String
- 统计每个字母出现次数即可。
B. Special Offer! Super Price 999 Bourles!
- 枚举末尾有几个9,注意不要爆掉\(long\ long\)的范围。
C. Color Stripe
- 当\(k\gt 2\)时,若\(s_i==s_{i-1}\),那么枚举新的字母使得\(s_i \ne s_{i-1},s_i \ne s_{i+1}\)。
- 当\(k\gt 2\)时,则需要枚举首位是\(A\)是\(B\)。在\(AAB\)这种情况下,\(k\gt 2\)做法是错误的。
D. Choosing Capital for Treeland
- 两遍dfs即可。
E. Parking Lot
- 两个set分别维护已占用的位置和空闲区间。
Codeforces Round #135 (Div. 2)的更多相关文章
- 树形DP Codeforces Round #135 (Div. 2) D. Choosing Capital for Treeland
题目传送门 /* 题意:求一个点为根节点,使得到其他所有点的距离最短,是有向边,反向的距离+1 树形DP:首先假设1为根节点,自下而上计算dp[1](根节点到其他点的距离),然后再从1开始,自上而下计 ...
- 构造 Codeforces Round #135 (Div. 2) B. Special Offer! Super Price 999 Bourles!
题目传送门 /* 构造:从大到小构造,每一次都把最后不是9的变为9,p - p MOD 10^k - 1,直到小于最小值. 另外,最多len-1次循环 */ #include <cstdio&g ...
- 贪心 Codeforces Round #135 (Div. 2) C. Color Stripe
题目传送门 /* 贪心:当m == 2时,结果肯定是ABABAB或BABABA,取最小改变量:当m > 2时,当与前一个相等时, 改变一个字母 同时不和下一个相等就是最优的解法 */ #incl ...
- Codeforces Round #135 (Div. 2) E. Parking Lot 线段数区间合并
E. Parking Lot time limit per test 2 seconds memory limit per test 256 megabytes input standard inpu ...
- Codeforces Round #135 (Div. 2) D. Choosing Capital for Treeland dfs
D. Choosing Capital for Treeland time limit per test 3 seconds memory limit per test 256 megabytes i ...
- Codeforces Round #135 (Div. 2)---A. k-String
k-String time limit per test 2 seconds memory limit per test 256 megabytes input standard input outp ...
- Codeforces Round #135 (Div. 2) D - Choosing Capital for Treeland(两种树形DP)
- Codeforces Round #135 (Div. 2) D. Choosing Capital for Treeland
time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standa ...
- 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 ...
随机推荐
- acvitity的日常 启动模式(上)
1. 基本介绍 大家平时只要懂一点Android知识的话,都一定会知道,一个应用的组成,往往包含了许多的activity组件,每个activity都应该围绕用户的特定动作进行跳转设计.比如说,一个电话 ...
- 监听cell 滑动到 摸个分区
//滑动过程中 - (void)scrollViewDidScroll:(UIScrollView *)scrollView { // NSLog(@"000---%ld", ...
- web api post传一个参数时 值永远是null
这个问题纠结了我一个早上,不管用什么样的传参方法,走到控制器中,那个参数永远不变的等于null 在网上找了很多解决方案 上面这个是从网上截图的,第一:要将参数标记为[FromBody],变为简单参数 ...
- 走进科学之WAF(Web Appllication Firewall)篇
小编P.S:文章非常详尽对WAF领域进行了一次科普,能有让人快速了解当前WAF领域的相关背景及现状,推荐所有WAF领域的同学阅读本文. 1. 前言 当WEB应用越来越为丰富的同时,WEB 服务器以其强 ...
- android 单选、多选弹出菜单
菜单单选窗口: import android.app.Activity;import android.app.AlertDialog;import android.content.DialogInte ...
- <button>使用注意问题
最近在项目的上传功能下(IE8)发现了如下的错误: 2015-08-13 09:14:03,396 WARN [WARN] [http-8080-5] : Handler execution re ...
- (转)Tomcat的目录结构
原文:http://hi.baidu.com/qinyougen/item/beeb506abb3e1d08a1cf0ffb Tomcat的目录结构 一.TOMCAT的目录结构 /bin:存放wind ...
- Virtual Friend Function
一般而言,友元作为一种紧耦合的设计,被视作类的一部分.一个经典的应用就是关于类的序列化和反序列化. class A { friend ostream& operator<<(ost ...
- Java 集合源码解析(1):Iterator
Java, Android 开发也有段时间了,当初为了早点学 Android,Java 匆匆了解个大概就结束了,基础不够扎实. 虽然集合框架经常用,但是一直没有仔细看看原理,仅止于会用,不知道为什么要 ...
- Android Studio, gradle plugin is too old or set ANDROID_DAILY_OVERRIDE
早上打开Android Studio,忽然报了个错,说gradle plugin版本过低,让更新或者设置ANDROID_DAILY_OVERRIDE环境变量: 日志如下: INFO - ls.idea ...