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)的更多相关文章

  1. 树形DP Codeforces Round #135 (Div. 2) D. Choosing Capital for Treeland

    题目传送门 /* 题意:求一个点为根节点,使得到其他所有点的距离最短,是有向边,反向的距离+1 树形DP:首先假设1为根节点,自下而上计算dp[1](根节点到其他点的距离),然后再从1开始,自上而下计 ...

  2. 构造 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 ...

  3. 贪心 Codeforces Round #135 (Div. 2) C. Color Stripe

    题目传送门 /* 贪心:当m == 2时,结果肯定是ABABAB或BABABA,取最小改变量:当m > 2时,当与前一个相等时, 改变一个字母 同时不和下一个相等就是最优的解法 */ #incl ...

  4. 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 ...

  5. 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 ...

  6. 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 ...

  7. Codeforces Round #135 (Div. 2) D - Choosing Capital for Treeland(两种树形DP)

  8. 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 ...

  9. 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 ...

随机推荐

  1. Xcode6.2创建Empty Application

    运行Xcode 6,创建一个Single View Application工程.   创建好后,把工程目录下的Main.storyboard和LaunchScreen.xib删除,扔进废纸篓.   打 ...

  2. Asp.net项目因Session阻塞导致页面打开速度变慢

    发现罪魁祸首是Session阻塞造成的.默认情况下session状态是“可写状态”(EnableSessionState=”true”),即当用户打开任何一个页面时,该页面的Session就会持有一个 ...

  3. Cygwin下载,安装教程

    Cygwin是一个用于在Windows上模拟Linux环境的软件,由于工作上的需要,我要使用它,至于为什么用它,我在这里不做过多的解释,本文的目的,旨在于解决Cygwin安装上的问题. 原始的安装Cy ...

  4. C++学习之类的构造函数、析构函数

    在C++的类中,都会有一个或多个构造函数.一个析构函数.一个赋值运算操作符.即使我们自己定义的类中,没有显示定义它们,编译器也会声明一个默认构造函数.一个析构函数和一个赋值运算操作符.例如: //声明 ...

  5. Javascript之clipBoard操作

    1.clipBoard 是网页上剪贴板,可以获取剪切板上值,可能类似物键-值对这种模式取值\赋值,如果在copy网上的某篇博客时,往往会带有“转载自xxxx地方 http://www.xxx.com/ ...

  6. 重拾java系列一java基础(3)

    这一章主要复习下以前所接触的算法, (1)选择排序法:在要排序的一组数中,选出最小的一个数与第一个位置的数交换:然后在剩下的数当中再找最小的与第二个位置的数交换,如此循环到倒数第二个数和最后一个数比较 ...

  7. (转)js的左右滑动触屏事件

    原文:http://blog.sina.com.cn/s/blog_6a0a183f0100zsfk.html (2012-01-20 08:55:53) 转载▼ 标签: 移动设备 触屏事件 杂谈 分 ...

  8. C++ shared_ptr deleter的实现

    #include <iostream>#include <memory>using namespace std; #include<iostream>class s ...

  9. python3爬虫初探(三)之正则表达式

    前面已经写了如何获取网页源码,那么接下来就是该解析网页并提取需要的数据了.这里简单写一下正则表达的用法. 首先,找个要抓取图片的网站,获取源码. import requests import re # ...

  10. C# INotifyPropertyChanged

    INotifyPropertyChanged 向客户端发出某一属性值已更改的通知. namespace System.ComponentModel{ // Summary: // Notifies c ...