Codeforces Round #451 & Codeforces Round #452

Rounding
Proper Nutrition
枚举
Phone Numbers
模拟
Alarm Clock
贪心,好像不用线段树也可以,事实证明我很擅长想得太多。
Squares and not squares
以后再也不用qsort了
Restoring the Expression
用哈希真的很讨厌好吗?你们怎么从来不考虑冲突的问题,用的那么毫无负担呢?
Splitting in Teams
Months and Years
Dividing the numbers
相邻的4个数字可以分成和相等的两部分,只有前最多3个会凑不出相同。
Shovel Sale
有的时候加不出9,这时候算最多个9,结果为n*(n-1)/2,草。
Segments Removal
stl大法好
Letters Removing
解法我已经会了,心情不好代码就不写了,描述一下过程:
首先用set记录各个字母都在哪些位置出现过
对于每次操作的输入lr,先找出lr在原字符串中对应的lr,然后根据c选择set,删除掉值位于lr之间的元素(很多次区间删除,所以用set)。
输出的时候62个set齐头并进,找到62个begin()中值最小的那个,输出对应字符,并删除该元素。
如何求lr在原字符串中的位置?
设a[i]表示按原字符串编号第i个字符串是否被删除,0为被删除,1为未被删除;s[i]表示1-i中有几个1,也可以当成a[1]+a[2]+...+a[i]。那么lr在原字符串中的位置就是最小的i满足s[i]=lr,用线段树或树状数组维护s数组,再二分确定最小的i,复杂度应该是nlgnlgn。
Codeforces Round #451 & Codeforces Round #452的更多相关文章
- Codeforces Round #451 (Div. 2) A B C D E
Codeforces Round #451 (Div. 2) A Rounding 题目链接: http://codeforces.com/contest/898/problem/A 思路: 小于等于 ...
- Codeforces Beta Round #27 (Codeforces format, Div. 2)
Codeforces Beta Round #27 (Codeforces format, Div. 2) http://codeforces.com/contest/27 A #include< ...
- MySQL四舍五入函数ROUND(x)、ROUND(x,y)和TRUNCATE(x,y)
MySQL四舍五入函数ROUND(x) ROUND(x)函数返回最接近于参数x的整数,对x值进行四舍五入. 实例: 使用ROUND(x)函数对操作数进行四舍五入操作.SQL语句如下: mysql> ...
- Codeforces Round #451 (Div. 2)-898A. Rounding 898B.Proper Nutrition 898C.Phone Numbers(大佬容器套容器) 898D.Alarm Clock(超时了,待补坑)(贪心的思想)
A. Rounding time limit per test 1 second memory limit per test 256 megabytes input standard input ou ...
- Codeforces Round #451 (Div. 2) A. Rounding【分类讨论/易错】
A. Rounding time limit per test 1 second memory limit per test 256 megabytes input standard input ou ...
- Codeforces Round #451 (Div. 2) [ D. Alarm Clock ] [ E. Squares and not squares ] [ F. Restoring the Expression ]
PROBLEM D. Alarm Clock 题 OvO http://codeforces.com/contest/898/problem/D codeforces 898d 解 从前往后枚举,放进 ...
- Codeforces Round #451 (Div. 2)
水题场.... 结果因为D题看错题意,B题手贱写残了...现场只出了A,C,E A:水题.. #include<bits/stdc++.h> #define fi first #defin ...
- Codeforces Round #451 (Div. 2) B. Proper Nutrition【枚举/扩展欧几里得/给你n问有没有两个非负整数x,y满足x·a + y·b = n】
B. Proper Nutrition time limit per test 1 second memory limit per test 256 megabytes input standard ...
- 【Codeforces Round #451 (Div. 2) A】Rounding
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 模拟 [代码] /* 1.Shoud it use long long ? 2.Have you ever test several ...
随机推荐
- 团体程序设计天梯赛-练习集-L1-046. 整除光棍
L1-046. 整除光棍 这里所谓的“光棍”,并不是指单身汪啦~ 说的是全部由1组成的数字,比如1.11.111.1111等.传说任何一个光棍都能被一个不以5结尾的奇数整除.比如,111111就可以被 ...
- BZOJ2251 [2010Beijing Wc]外星联络 后缀数组 + Height数组
Code: #include <bits/stdc++.h> #define setIO(s) freopen(s".in", "r", stdin ...
- 在LinuxMint19上安装搜狗拼音输入法
写在前面 由于Linux mint是基于Ubuntu的深度改造,所以按照网上针对Ubuntu的安装方法基本都是有用的.LinuxMint自身就携带了IBUS和fcitx两个框架.然而并非每次都能正常使 ...
- 读取linux服务器内带格式文件,转为json字符串
工具类方法:ReadTextUtil package com.dc.health.platform.common.utils; import com.alibaba.fastjson.JSONObje ...
- ubuntu 配置lamp
官方配置网站:http://wiki.ubuntu.org.cn/LAMP_%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%A ...
- ps图标长投影如何做?
https://jingyan.baidu.com/article/2f9b480dad9c8e41cb6cc297.html ps图标长投影
- springMVC知识点复习
@ResponseBody和@RequestBody的使用 <html> <script type="text/javascript" src="rel ...
- 使用timthumb.php截取文章缩略图
wordpress自带的缩略图功能会对每次上传的所有图片根据设置的图片尺寸进行裁剪,并把原图和裁剪后的图片保存在网站空间中,图片只裁剪一次,更改设置的尺寸不会重新生成,这样不仅占用主机空间,以后改版网 ...
- php模拟并发
原文: http://blog.csdn.net/zhang_xinglong/article/details/16339867 ----------------------------------- ...
- currentThread()方法返回代码段正在被哪个线程调用
currentThread()方法返回代码段正在被哪个线程调用 package com.stono.thread2.page16; public class MyThread extends Thre ...