Codeforces Round #129 (Div. 2)
A. Little Elephant and Rozdil
- 求\(n\)个数中最小值的个数及下标。
B. Little Elephant and Sorting
- \[\sum_{i=1}^{n-1}{max(0, a_i-a_{i+ 1})}\]
C. Little Elephant and Interval
- 问题转化成求\([1,n]\)范围内满足题意的数的个数。
- 假设\(n\)的位数为\(L\),当\(L \gt 2\)时,若\(x\)的位数小于\(L\),则除了首位和末位以外,其余位任意取值,即\(9\cdot 10^{i - 2}\)。
若\(x\)的位数等于\(L\),那么考虑首位与\(n\)的首位大小关系,小于的情况下后面位任意取,相等情况下需要考虑\(n\)末位与首位的大小关系。
D. Little Elephant and Cards
- 对颜色离散化后,统计每种颜色正面个数以及背面个数。
- 注意正面颜色和背面颜色可能相同。
E. Little Elephant and Furik and Rubik
- 假设\(a_i=b_j\),那么这对的贡献为\(min(i,j)*min(n-i+1, n-j+1)\)。
- 如果固定住位置\(i\),将\(j\)分成小于\(i\)和大于等于\(i\)两部分,就可以统计出\(i\)的所有贡献。
Codeforces Round #129 (Div. 2)的更多相关文章
- 字符串(后缀自动机):Codeforces Round #129 (Div. 1) E.Little Elephant and Strings
E. Little Elephant and Strings time limit per test 3 seconds memory limit per test 256 megabytes inp ...
- Codeforces Round #129 (Div. 1)E. Little Elephant and Strings
题意:有n个串,询问每个串有多少子串在n个串中出现了至少k次. 题解:sam,每个节点开一个set维护该节点的字符串有哪几个串,启发式合并set,然后在sam上走一遍该串,对于每个可行的串,所有的fa ...
- Codeforces Round #129 (Div. 2) C
Description The Little Elephant very much loves sums on intervals. This time he has a pair of intege ...
- Codeforces Round #129 (Div. 2) B
Description The Little Elephant loves sortings. He has an array a consisting of n integers. Let's nu ...
- Codeforces Round #129 (Div. 2) A
Description The Little Elephant loves Ukraine very much. Most of all he loves town Rozdol (ukr. &quo ...
- Educational Codeforces Round 129 (Rated for Div. 2) A-D
Educational Codeforces Round 129 (Rated for Div. 2) A-D A 题目 https://codeforces.com/contest/1681/pro ...
- 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”三种中任意一种就输 ...
随机推荐
- HDU 2594 扩展kmp模板题
题目大意: 给定两个字符串,在第一个字符串中找到一个最大前缀作为第二个字符串的后缀 #include <iostream> #include <cstdio> #include ...
- HDU 1203-Program D
Description Speakless很早就想出国,现在他已经考完了所有需要的考试,准备了所有要准备的材料,于是,便需要去申请学校了.要申请国外的任何大学,你都要交纳一定的申请费用,这可是很惊人的 ...
- JavaScript 之 走马灯
1.原理分析:首先截取字符串的最后一位用Last表示,再截取剩余字符串用Rest表示,拼接字符串Last + Rest, 此事字符串是不会动的,还需要一个函数setInterval(javascrip ...
- 深入C#数据类型小部分第二章
值类型和引用类型C#的值类型包括:结构体(数值类型,bool型,用户定义的结构体),枚举,可空类型. C#的引用类型包括:数组,用户定义的类.接口.委托,object,字符串. 数组的元素,不管是引用 ...
- 关于$.getJson
这是一个Ajax函数的缩写,这相当于: 1 2 3 4 5 6 $.ajax({ dataType: "json", url: url, data: data, success: ...
- hdu2196 树的直径 + bfs
//Accepted 740 KB 15 ms //树的直径 //距离一个顶点最远的点一定是树的直径的一个端点 #include <cstdio> #include <cstring ...
- python中的面向对象编程
在python中几乎可以完成C++里所有面向对象编程的元素. 继承:python支持多继承: class Derived(base1, base2, base3): pass 多态:python中的所 ...
- 配置VS2010具有代码提示功能
Visual Assist X是一款非常好的Microsoft Visual Studio插件,可以支持Microsoft Visual Studio 2003,Microsoft Visual St ...
- Ubuntu系统下运行Eclipse出现找不到jre的问题的解决方法
在Ubuntu的某些版本下,比如10.10,会出现以下奇怪问题: 1. 安装jdk 我下载的jdk是bin格式的,直接运行解压,得到一个文件夹. 这个文件夹作为jdk的安装目录,可以拷贝到任意目录. ...
- FR #2题解
A. 考虑把(u,v)的询问离线挂在u上,然后dfs,每次从fath[x]到[x]相当于x子树dis区间加1,x子树以外区间-1,然后维护区间和区间平方和等. 常数略大. #include<io ...