CodeForces 549G Happy Line】的更多相关文章

Happy Line Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 549G Description Do you like summer? Residents of Berland do. They especially love eating ice cream in the hot summer. So this…
G. Happy Line time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Do you like summer? Residents of Berland do. They especially love eating ice cream in the hot summer. So this summer day a larg…
非常有趣的贪婪: Let's reformulate the condition in terms of a certain height the towers, which will be on the stairs. Then an appropriate amount of money of a person in the queue is equal to the height of the tower with the height of the step at which the t…
题目链接:http://codeforces.com/problemset/problem/349/A 题目意思:题目不难理解,从一开始什么钱都没有的情况下,要向每一个人售票,每张票价格是25卢布,这些人只可能拥有100,50,25的其中一张卢布.问:售票员是否能在可以找赎的情况下,向每一个人都售到票. 此题被贴上贪心的标签,但我觉得更像模拟题.用了比较笨的方法来解决,但是毕竟是自己编的,还是比较有感觉.要特别注意,收了别人的钱,相应的面额数量要作相应的改动.例如第一个样例的25 25 50 5…
题目链接:http://codeforces.com/problemset/problem/549/G 题意:给定一个n个元素的整数序列a[], 任意时刻对于任一对相邻元素a[i-1]. a[i],若a[i-1] < a[i] 则要依次执行如下两个操作: 1. a[i-1]--, a[i]++: 2. 交换a[i-1]和a[i]的位置. 经过若干次1.2操作后,若能使整个序列变成非降的,则输出最终的序列:否则输出":(". 数据范围:n 属于 [1, 2*10^5], a[i]…
题目链接:http://codeforces.com/contest/431/problem/B 题目意思:给出5 * 5 的矩阵.从这个矩阵中选出合理的安排次序,使得happiness之和最大.当第i个人和第j个人talk 的时候,第i个人获得的happiness是g[i][j],第j 个人获得的happiness是g[j][i]. 好简单的一道题目,不知道昨晚徘徊好久都不敢打,五个for循环即可!数据量这么小......今天一次就过了... 谨以此来纪念自己的怯懦.... 方法一:直接暴力枚…
[codeforces 549]G. Happy Line 试题描述 Do you like summer? Residents of Berland do. They especially love eating ice cream in the hot summer. So this summer day a large queue of n Berland residents lined up in front of the ice cream stall. We know that ea…
[Educational Codeforces Round 16]B. Optimal Point on a Line 试题描述 You are given n points on a line with their coordinates xi. Find the point x so the sum of distances to the given points is minimal. 输入 The first line contains integer n (1 ≤ n ≤ 3·105)…
B. Psychos in a Line Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/problem/319/B Description There are n psychos standing in a line. Each psycho is assigned a unique integer from 1 to n. At each step every psycho who h…
2018-02-25 http://codeforces.com/contest/940/problem/A A. Points on the line time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output We've got no test cases. A big olympiad is coming up. But the pr…