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 ...
随机推荐
- C# 发起Get和Post请求
public class ApiHelper { //contentType application/json or application/xml public string HttpGet(str ...
- loadrunner安装方法
1.loadrunner安装网盘地址: http://pan.baidu.com/s/1hrP6mDQ 一般会提示:“vc2005_sp1_with_atl_fix_redist 2.确认时提示缺少 ...
- eas之日志文件夹
F:\ThisIs_MyWork\kingdee\eas\server\profiles\server1\logs 服务端的日志文件夹 F:\ThisIs_MyWork\kingdeecusto ...
- C#第八节课
for的穷举迭代.while.do while using System;using System.Collections.Generic;using System.Linq;using Syste ...
- 【Leetcode】【简单】【169求众数】【JavaScript】
题目 169. 求众数 给定一个大小为 n 的数组,找到其中的众数.众数是指在数组中出现次数大于 ⌊ n/2 ⌋ 的元素. 你可以假设数组是非空的,并且给定的数组总是存在众数. 示例 1: 输入: [ ...
- [luogu2825 HEOI2016/TJOI2016] 游戏 (二分图最大匹配)
传送门 Description 在2016年,佳缘姐姐喜欢上了一款游戏,叫做泡泡堂.简单的说,这个游戏就是在一张地图上放上若干个炸弹,看是否能炸到对手,或者躲开对手的炸弹.在玩游戏的过程中,小H想到了 ...
- Spring Boot学习总结(3)——SpringBoot魅力所在
使用Java做Web应用开发已经有近20年的历史了,从最初的Servlet1.0一步步演化到现在如此多的框架,库以及整个生态系统.经过这么长时间的发展,Java作为一个成熟的语言,也演化出了非常成熟的 ...
- maven知识总结
使用maven中的命令运行web项目 以上为web项目的目录结构 必须是maven项目 启动命令行 使用 mvn tomcat:run 敲击回车 访问红框中的地址: 关闭命令行 那么项目就 ...
- hdu 3072 强连通+缩点+最小树形图思想
#include<stdio.h> #include<string.h> #define N 51000 #define inf 1000000000 struct node ...
- ExtJs之gridPanel的属性表格,编辑表格,表格分页,分组等技巧
这里藏的配置确实多.. 慢慢实践吧. <!DOCTYPE html> <html> <head> <title>ExtJs</title> ...