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 // WA了3次。。。
// notice that
// "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"
// "if the max score he could get on board add his current score is equal to the opponent's current score, still output "Yes""
 #include<stdio.h>
#define COLOR 27
int main()
{
int n, left, score, opp, re;
scanf("%d", &n);
while(n--)
{
scanf("%d %d %d", &left, &score, &opp);
if(left<=) re=*left-left*(left-)/;
else re=left-+*(left-)+COLOR;
if(score+re>=opp) printf("Yes\n");
else printf("No\n");
}
return ;
}

AC

3P - Snooker的更多相关文章

  1. HDOJ(HDU) 2060 Snooker(英语很重要。。。)

    Problem Description background: Philip likes to play the QQ game of Snooker when he wants a relax, t ...

  2. 斯诺克台球比赛规则 (Snooker)

    斯诺克台球比赛规则 斯诺克(Snooker)的意思是“阻碍.障碍”,所以斯诺克台球有时也被称为障碍台球.此项运动使用的球桌长约3569毫米.宽1778毫米,台面四角以及两长边中心位置各有一个球洞,使用 ...

  3. soj1047.Super Snooker(转换思路+二路求和)

    Description On one of my many interplanetary travels I landed on a beautiful little planet called Cr ...

  4. 3p

    哈,不要自卑.爱情和婚姻可遇不可求,缘到自然成.首要的是人好,容貌別太差,毕竟天天在一起看着要舒心才好,另外应该有上进心,避免势利小人.这些,都要看机缘.所谓right person at right ...

  5. CentOS6.x服务器OpenSSH平滑7.3p版本——拒绝服务器漏洞攻击

    对于新安装的Linux服务器,默认OpenSSH及OpenSSL都不是最新的,需要进行升级以拒绝服务器漏洞攻击.本次介绍的是升级生产环境下CentOS6.x系列服务器平滑升级OpenSSL及OpenS ...

  6. CentOS6.x服务器OpenSSH平滑升级到7.3p版本——拒绝服务器漏洞攻击

    对于新安装的Linux服务器,默认OpenSSH及OpenSSL都不是最新的,需要进行升级以拒绝服务器漏洞攻击.本次介绍的是升级生产环境下CentOS6.x系列服务器平滑升级OpenSSL及OpenS ...

  7. 如何在ASP.Net创建各种3D图表

    我们都知道,图表在ASP.NET技术中是一种特别受欢迎而又很重要的工具.图表是表示数据的图形,一般含有X和Y两个坐标轴.我们可以用折线,柱状,块状来表示数据.通过图表控件,我们即能表示数据又能比较各种 ...

  8. Nginx反向代理,负载均衡,redis session共享,keepalived高可用

    相关知识自行搜索,直接上干货... 使用的资源: nginx主服务器一台,nginx备服务器一台,使用keepalived进行宕机切换. tomcat服务器两台,由nginx进行反向代理和负载均衡,此 ...

  9. Android—关于自定义对话框的工具类

    开发中有很多地方会用到自定义对话框,为了避免不必要的城府代码,在此总结出一个工具类. 弹出对话框的地方很多,但是都大同小异,不同无非就是提示内容或者图片不同,下面这个类是将提示内容和图片放到了自定义函 ...

随机推荐

  1. delphi字符串分割

    function GetLeft(sText, sepStr: string): string; var p: Integer; begin p := Pos(sepStr, sText); then ...

  2. 一次完整的HTTP事务是怎样一个过程?(转)

    HTTP协议 关于HTTP协议可以参考以下: HTTP协议漫谈 http://kb.cnblogs.com/page/140611/ HTTP协议概览 http://www.cnblogs.com/v ...

  3. 【python】如何将ipdb的python解释器路径切换至虚拟环境中

    背景: 利用virtualenv构建一个python3.5的虚拟环境,在该虚拟环境中使用ipdb调试程序,结果报错找不到某一个模块. 程序的所有依赖模块都已经成功安装在虚拟环境中. 在虚拟环境中,te ...

  4. dns缓存刷新时间是多久?dns本地缓存时间介绍

    原文: http://www.winwin7.com/JC/4742.html dns缓存刷新时间是多久?一般来说,我们只知道DNS解析是互联网绝大多数应用的实际寻址方式,在我们打开某站点,DNS返回 ...

  5. 异步启动solidworks

    两种方法: SldWorks App = new SldWorks(); App.Visible = true; //SldWorks.Application.24是2016 // App = (Sl ...

  6. 地图api

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  7. Oracle 学习笔记(二)

    一.索引 表的数据是无序的,所以叫堆表(heap table),意思为随机存储数据.因为数据是随机存储的,所以在查询的时候需要全表扫描.索引就是将无序的数据有序化,这样就可以在查询数据的时候 减少数据 ...

  8. python——列表入门

    学习列表先分析一段程序: list = ['zx', 'xkd', 1997, 2018] list1=list+[1,2,3]#列表拼接 list2=[list,list1] print('嵌套的列 ...

  9. leetcode1028

    class Solution(object): def __init__(self): self.List = list() def rdfs(self,S): if S != '': length ...

  10. C# 委托和泛型

    委托定义: 委托是一个类,它定义了方法的类型,使得可以将方法当作另一个方法的参数来进行传递,这种将方法动态地赋给参数的做法,可以避免在程序中大量使用If-Else(Switch)语句,同时使得程序具有 ...