CodeForces 156A Message(暴力)】的更多相关文章

A. Message time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Dr. Moriarty is about to send a message to Sherlock Holmes. He has a string s. String p is called a substring of string s if you…
On the way to school, Karen became fixated on the puzzle game on her phone! The game is played as follows. In each level, you have a grid with n rows and mcolumns. Each cell originally contains the number 0. One move consists of choosing one row or c…
Chladni Figure CodeForces - 1162D Inaka has a disc, the circumference of which is nn units. The circumference is equally divided by nn points numbered clockwise from 11 to nn, such that points ii and i+1i+1 (1≤i<n1≤i<n) are adjacent, and so are poin…
The only difference between easy and hard versions is a number of elements in the array. You are given an array aa consisting of nn integers. The value of the ii-th element of the array is aiai. You are also given a set of mm segments. The jj-th segm…
题目链接:http://codeforces.com/problemset/problem/589/D 题目大意:给出n个人行走的开始时刻,开始时间和结束时间,求每个人分别能跟多少人相遇打招呼(每两人只能打招呼一次). 例: 输入:31 1 105 8 29 9 10 输出: 2 1 1 解题思路:先按行走的开始时刻排下序,然后直接模拟判断和比他后出现的人是否可以相遇. 第一步判断前面那个人在未走完前,下一人会出现,若不出现,直接break.然后就计算当下一个人出现的时刻,前一个人的位置,然后又…
题目链接:http://codeforces.com/problemset/problem/589/B 题目大意:告诉你n 个矩形,知道矩形的长度和宽度(长和宽可以互换),每个矩形的长度可以剪掉一部分,宽度也同样,求出可以得到多少个一样(每个矩形的长相等,宽也相等)的矩形,使得面积之和最大,并输出长和宽. 解题思路:将每个矩形的长和宽都存到一个结构体数组内,对矩形的长进行排序,因为最终结果的长一定是某个矩形的长,宽也一定是某个矩形的宽,所以我们枚举长,然后将长大于等于该长度的矩形的宽加入到一个向…
Dasha decided to bake a big and tasty layer cake. In order to do that she went shopping and bought n rectangular cake layers. The length and the width of the i-th cake layer were ai and birespectively, while the height of each cake layer was equal to…
题目传送门 传送门I 传送门II 传送门III 题目大意 求一个满足$d\sum_{i = 1}^{n} \left \lceil \frac{a_i}{d} \right \rceil - \sum_{i = 1}^{n} a_{i} \leqslant K$的最大正整数$d$. 整理一下可以得到条件是$d\sum_{i = 1}^{n} \left \lceil \frac{a_i}{d} \right \rceil \leqslant K + \sum_{i = 1}^{n} a_{i}$…
纯暴力..... B. Towers time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output As you know, all the kids in Berland love playing with cubes. Little Petya has n towers consisting of cubes of the same si…
A. Cookies time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Olga came to visit the twins Anna and Maria and saw that they have many cookies. The cookies are distributed into bags. As there…