杭电 2060

Snooker

Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)

Total Submission(s): 6707    Accepted Submission(s): 2839

Problem Description

background:

Philip likes to play the QQ game of Snooker when he wants a relax, though he was just a little vegetable-bird. Maybe you hadn‘t played that game yet, no matter, I‘ll introduce the rule for you first.

There are 21 object balls on board, including 15 red balls and 6 color balls: yellow, green, brown, blue, pink, black.

The player should use a white main ball to make the object balls roll into the hole, the sum of the ball‘s fixed value he made in the hole is the player‘s score. The player should firstly made a red ball into the hole, after that he gains red-ball‘s value(1
points), then he gets the chance to make a color ball, then alternately. The color ball should be took out until all the red-ball are in the hole. In other word, if there are only color balls left on board, the player should hit the object balls in this order:
yellow(2 point), green(3 point), brown(4 point), blue(5 point), pink(6 point), black(7 point), after the ball being hit into the hole, they are not get out of the hole, after no ball left on board, the game ends, the player who has

the higher score wins the game. PS: red object balls never get out of the hole.

I just illustrate the rules that maybe used, if you want to contact more details, visit http://sports.tom.com/snooker/ after

the contest.

for example, if there are 12 red balls on board(if there are still red ball left on board, it can be sure that all the color

balls must be on board either). So suppose Philp can continuesly hit the ball into the hole, he can get the maximun score is

12 * 1 (12 red-ball in one shoot) + 7 * 12(after hit a red ball, a black ball which was the most valuable ball should be the target) + 2 + 3 + 4 + 5 + 6 + 7(when no red ball left, make all the color ball in hole).

Now, your task is to judge whether Philip should make the decision to give up when telling you the condition on board(How many object balls still left not in the hole and the other player‘s score). If Philp still gets the chance to win, just print "Yes", otherwise
print "No". (PS: if the max score he could get on board add his current score is equal to the opponent‘s current score, still output "Yes")

Input

The first line contains a numble N indicating the total conditions. Then followed by N lines, each line is made of three integers:

Ball_Left P_Score O_Score represeting the ball number left on board, Philp‘s current score, and the opponent‘s current score.

All the input value are in 32 bit integer value range.

Output

You should caculate the max score left Philp can gain, and judge whether he has the possiblity to win.

Sample Input

2
12 1 1
1 30 39

Sample Output

Yes
No

Author

zl

Source

校庆杯Warm Up

题目意思是给你三个数分别是桌面上还剩下的球的数量,目前你的比分还有你对手的比分

假设你能一杆清球,求在这种情况下,你是否还有赢的可能,要是有的话,输出Yes否No

就是要使桌面上的球的数量大于6的时候,因为题目的要求是要先打红球,才有打彩球的机会,

要想获得最大分数,打黑球,没有6的球的时候,按照次序打,仅打彩球总共能获得27分 再

加上其他的分数看是否满足条件,

就是一到简单的数学题

分两种情况讨论即可

代码如下 :

#include<stdio.h>

int main()

{

int n;

scanf("%d",&n);

while(n--)

{

int i,j,a,b,c,sum=0;

scanf("%d%d%d",&a,&b,&c);

if(a>6)

puts(b+(a-6)*(1+7)+27>=c?"Yes":"No");

else

{

for(i=7,j=0;j<a;j++,i--)

sum+=i;

puts(b+sum>=c?"Yes":"No");

}

}

return 0;

}

杭电 2060

时间: 2024-08-29 09:16:46

杭电 2060的相关文章

杭电2060

#include<iostream> using namespace std; int main() { int n,a,b,c,i,sum,j; cin>>n; while(n--) { sum=0; getchar(); cin>>a>>b>>c; if(a>6) puts(b+(a-6)*(1+7)+27>=c?"Yes":"No"); else { for(i=7,j=0;j<a;

杭电ACM题目分类

杭电ACM题目分类 基础题:1000.1001.1004.1005.1008.1012.1013.1014.1017.1019.1021.1028. 1029.1032.1037.1040.1048.1056.1058.1061.1070.1076.1089.1090.1091.1092. 1093.1094.1095.1096.1097.1098.1106.1108.1157.1163.1164.1170.1194.1196. 1197.1201.1202.1205.1219.1234.123

杭电 HDU 1164 Eddy&#39;s research I

Eddy's research I Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7117    Accepted Submission(s): 4268 Problem Description Eddy's interest is very extensive, recently  he is interested in prime

hdu 1016 Prime Ring Problem DFS解法 纪念我在杭电的第一百题

Prime Ring Problem Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 29577    Accepted Submission(s): 13188 Problem Description A ring is compose of n circles as shown in diagram. Put natural num

杭电ACM分类

杭电ACM分类: 1001 整数求和 水题1002 C语言实验题——两个数比较 水题1003 1.2.3.4.5... 简单题1004 渊子赛马 排序+贪心的方法归并1005 Hero In Maze 广度搜索1006 Redraiment猜想 数论:容斥定理1007 童年生活二三事 递推题1008 University 简单hash1009 目标柏林 简单模拟题1010 Rails 模拟题(堆栈)1011 Box of Bricks 简单题1012 IMMEDIATE DECODABILITY

一个人的旅行 HDU杭电2066【dijkstra算法】

http://acm.hdu.edu.cn/showproblem.php?pid=2066 Problem Description 虽然草儿是个路痴(就是在杭电待了一年多,居然还会在校园里迷路的人,汗~),但是草儿仍然很喜欢旅行,因为在旅途中 会遇见很多人(白马王子,^0^),很多事,还能丰富自己的阅历,还可以看美丽的风景--草儿想去很多地方,她想要去东京铁塔看夜景,去威尼斯看电影,去阳明山上看海芋,去纽约纯粹看雪景,去巴黎喝咖啡写信,去北京探望孟姜女--眼看寒假就快到了,这么一大段时间,可不

杭电1162--Eddy&#39;s picture(Prim()算法)

Eddy's picture Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8070    Accepted Submission(s): 4084 Problem Description Eddy begins to like painting pictures recently ,he is sure of himself to b

杭电1276--士兵队列训练问题

士兵队列训练问题 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4605    Accepted Submission(s): 2148 Problem Description 某部队进行新兵队列训练,将新兵从一开始按顺序依次编号,并排成一行横队,训练的规则如下:从头开始一至二报数,凡报到二的出列,剩下的向小序号方向靠拢,再从头开始进行

杭电1272 并查集找环+判断连通

杭电1272 并查集找环+判断连通 E - E Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1272 Description 上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走.但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B