HDU 2060 Snooker

来源:互联网 发布:辐射4 捏脸数据 编辑:程序博客网 时间:2024/05/24 05:26

http://acm.hdu.edu.cn/showproblem.php?pid=2060

 

Snooker

Time Limit: 1000/1000 MS(Java/Others)    MemoryLimit: 32768/32768 K (Java/Others)
Total Submission(s):3697    AcceptedSubmission(s): 1565


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 playedthat game yet, no matter, I'll introduce the rule for youfirst.
There are 21 object balls on board, including 15 red balls and 6color balls: yellow, green, brown, blue, pink, black.
The player should use a white main ball to make the object ballsroll into the hole, the sum of the ball's fixed value he made inthe hole is the player's score. The player should firstly made ared ball into the hole, after that he gains red-ball's value(1points), then he gets the chance to make a color ball, thenalternately. The color ball should be took out until all thered-ball are in the hole. In other word, if there are only colorballs left on board, the player should hit the object balls in thisorder: yellow(2 point), green(3 point), brown(4 point), blue(5point), pink(6 point), black(7 point), after the ball being hitinto the hole, they are not get out of the hole, after no ball lefton board, the game ends, the player who has
the higher score wins the game. PS: red object balls never get outof the hole.
I just illustrate the rules that maybe used, if you want to contactmore details, visit http://sports.tom.com/snooker/ after
the contest.

for example, if there are 12 red balls on board(if there are stillred ball left on board, it can be sure that all the color
balls must be on board either). So suppose Philp can continueslyhit 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, ablack 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 colorball in hole).
Now, your task is to judge whether Philip should make the decisionto give up when telling you the condition on board(How many objectballs still left not in the hole and the other player's score). IfPhilp still gets the chance to win, just print "Yes", otherwiseprint "No". (PS: if the max score he could get on board add hiscurrent score is equal to the opponent's current score, stilloutput "Yes")
 


 

Input
The first line contains a numble Nindicating the total conditions. Then followed by N lines, eachline is made of three integers:
Ball_Left P_Score O_Score represeting the ball number left onboard, Philp's current score, and the opponent's currentscore.
All the input value are in 32 bit integer value range.
 


 

Output
You should caculate the max score leftPhilp can gain, and judge whether he has the possiblity towin.
 


 

Sample Input
2 12 1 1 130 39
 


 

Sample Output
YesNo
 


 

Author
zl
 


 

Source
校庆杯Warm Up
 


 

Recommend
linle
 
题目大意:斯诺克。给出当前球数,b的分数,c的分数。问:接下来b全部一杆进洞,分数能否追上c?
分析:斯诺克的分数可以打表判断。注意是追上,所以分数相等也输出Yes.
代码如下:
#include<stdio.h>
#include<string.h>
#include<math.h>
int fen[]={0,7,13,18,22,25,27};
int fun(int x)
{
   if(x<=6) return fen[x];
    else return(8*(x-6)+fen[6]);
}
int main()
{
 int T;
 int a,b,c;
 scanf("%d",&T);
 while(T--)
 {
  scanf("%d%d%d",&a,&b,&c);
  if(b+fun(a)>=c)printf("Yes\n");
  else printf("No\n");
 }
 return 0;
}
原创粉丝点击