Codeforces Round #325 (Div. 1) 解题报告
来源:互联网 发布:下拉菜单获取数据库 编辑:程序博客网 时间:2024/06/01 10:26
题意:有n个孩子排队看病,每次排在第一的孩子进去看病,然后他会哭,最后在他之后的孩子的p值会依次减少vi,vi-1,vi-2……,0,0,0,0,……0。当某个孩子的p<0,则这个孩子也会哭,然后在他之后的所有孩子的p值都会减少di。问,最后医生能够给几个孩子看病。
做法:for套for,暴力模拟
B. Phillip and Trains
题意:3*n的网格,s在最左端某处,每次他可以往右走一步,然后再或上或下走一步或不动。有k个火车从右往左开,每次可以走两步。s先走,火车再走,s又走,火车又走,以此类推。问,s是否能够走到最右端。
做法:dp[r][c][t],在时间t走到r行c列,这个状态能否走到最右断。
C. Alice, Bob, Oranges and Apples
题意:袋子里有x个苹果,y个橘子。a有一个苹果,b有一个橘子。每次你选择一个人把他的水果都给另一个人,然后他再从袋子里拿走他原来的水果数量。问,是否有方法把袋子里的水果刚好拿完。
做法:画一棵树根的三个儿子从左往右结点代表的数对分别是(0,1),(1,1),(1,0)的解答树,只需要判断给出的(x,y)是不是在这棵树中即可。判断方法就是若a>b,则走到(a-b,b),若a<b,则走到(a,b-a),只需要看能否走到(1,1)就知道这个结点是否存在。
D. Lizard Era: Beginning
题意:有n把游戏,每把有三个人的分数,你可以选择任意两个保留。没把都要选择,问,最后能否使得三个人的分数之和一样,且a的分数之和最大。
做法:先暴力出n/2的情况存到map[(b跟a的分数差,c跟a的分数差),(a的分数,把选择情况状压)]里,再暴力出剩下的情况,在map中看能否找到合适的使得他们组合在一起满足要求,不断用a的分数更新最大值即可。
In the game Lizard Era: Beginning the protagonist will travel with three companions: Lynn, Meliana and Worrigan. Overall the game has nmandatory quests. To perform each of them, you need to take exactly two companions.
The attitude of each of the companions to the hero is an integer. Initially, the attitude of each of them to the hero of neutral and equal to 0. As the hero completes quests, he makes actions that change the attitude of the companions, whom he took to perform this task, in positive or negative direction.
Tell us what companions the hero needs to choose to make their attitude equal after completing all the quests. If this can be done in several ways, choose the one in which the value of resulting attitude is greatest possible.
The first line contains positive integer n (1 ≤ n ≤ 25) — the number of important tasks.
Next n lines contain the descriptions of the tasks — the i-th line contains three integers li, mi, wi — the values by which the attitude of Lynn, Meliana and Worrigan respectively will change towards the hero if the hero takes them on the i-th task. All the numbers in the input are integers and do not exceed 107 in absolute value.
If there is no solution, print in the first line "Impossible".
Otherwise, print n lines, two characters is each line — in the i-th line print the first letters of the companions' names that hero should take to complete the i-th task ('L' for Lynn, 'M' for Meliana, 'W' for Worrigan). Print the letters in any order, if there are multiple solutions, print any of them.
31 0 00 1 00 0 1
LMMWMW
70 8 95 9 -26 -8 -79 4 5-4 -9 9-4 5 2-6 8 -7
LMMWLMLWMWLMLW
21 0 01 1 0
Impossible
- Codeforces Round #325 (Div. 1) 解题报告
- Codeforces Round #250 (Div.1) 解题报告
- Codeforces Round #327 (Div. 1) 解题报告
- Codeforces Round #326 (Div. 1) 解题报告
- Codeforces Round #240 (Div. 1) 前3题 解题报告
- Codeforces Round #278 (Div. 1) 解题报告 A.B.
- Codeforces Round #283 (Div. 1)解题报告A.B.C.
- Codeforces Round #290 (Div. 1) 解题报告(A B)
- Codeforces Round #299 (Div. 1) 解题报告 (AB)
- Codeforces Round #305 (Div. 1) A.B.C 解题报告
- Codeforces Round #283 (Div. 1)解题报告A.B.C.
- [Updating]Codeforces Round #402 (Div. 1)解题报告
- Codeforces Round #453 (Div. 1)解题报告(ABCD)
- Codeforces Round #149 (Div. 2)解题报告
- Codeforces Round #180 (Div. 2) 解题报告
- Codeforces Round #190 (Div. 2) 解题报告
- Codeforces Round #191 (Div. 2) 解题报告
- Codeforces Round #189 (Div. 2) 解题报告
- java泛型
- Zabbix 客户端自定义端口监控
- c语言实现,图形界面扫雷
- LeetCode题解——Flatten Binary Tree to Linked List
- QT 的信号与槽机制介绍
- Codeforces Round #325 (Div. 1) 解题报告
- HDU 2234 无题I
- 如何解决win7开机提示未能连接一个Windows服务
- C语言实现链表之单向链表(九)在任意位置插入结点
- Java Exception
- 快速排序
- 手机端实现Protocol Buffer
- scala + intellij idea 环境搭建及编译、打包
- Ackerman函数