3P - Snooker
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.
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的更多相关文章
- HDOJ(HDU) 2060 Snooker(英语很重要。。。)
Problem Description background: Philip likes to play the QQ game of Snooker when he wants a relax, t ...
- 斯诺克台球比赛规则 (Snooker)
斯诺克台球比赛规则 斯诺克(Snooker)的意思是“阻碍.障碍”,所以斯诺克台球有时也被称为障碍台球.此项运动使用的球桌长约3569毫米.宽1778毫米,台面四角以及两长边中心位置各有一个球洞,使用 ...
- soj1047.Super Snooker(转换思路+二路求和)
Description On one of my many interplanetary travels I landed on a beautiful little planet called Cr ...
- 3p
哈,不要自卑.爱情和婚姻可遇不可求,缘到自然成.首要的是人好,容貌別太差,毕竟天天在一起看着要舒心才好,另外应该有上进心,避免势利小人.这些,都要看机缘.所谓right person at right ...
- CentOS6.x服务器OpenSSH平滑7.3p版本——拒绝服务器漏洞攻击
对于新安装的Linux服务器,默认OpenSSH及OpenSSL都不是最新的,需要进行升级以拒绝服务器漏洞攻击.本次介绍的是升级生产环境下CentOS6.x系列服务器平滑升级OpenSSL及OpenS ...
- CentOS6.x服务器OpenSSH平滑升级到7.3p版本——拒绝服务器漏洞攻击
对于新安装的Linux服务器,默认OpenSSH及OpenSSL都不是最新的,需要进行升级以拒绝服务器漏洞攻击.本次介绍的是升级生产环境下CentOS6.x系列服务器平滑升级OpenSSL及OpenS ...
- 如何在ASP.Net创建各种3D图表
我们都知道,图表在ASP.NET技术中是一种特别受欢迎而又很重要的工具.图表是表示数据的图形,一般含有X和Y两个坐标轴.我们可以用折线,柱状,块状来表示数据.通过图表控件,我们即能表示数据又能比较各种 ...
- Nginx反向代理,负载均衡,redis session共享,keepalived高可用
相关知识自行搜索,直接上干货... 使用的资源: nginx主服务器一台,nginx备服务器一台,使用keepalived进行宕机切换. tomcat服务器两台,由nginx进行反向代理和负载均衡,此 ...
- Android—关于自定义对话框的工具类
开发中有很多地方会用到自定义对话框,为了避免不必要的城府代码,在此总结出一个工具类. 弹出对话框的地方很多,但是都大同小异,不同无非就是提示内容或者图片不同,下面这个类是将提示内容和图片放到了自定义函 ...
随机推荐
- Java面试题 OOAD & UML+XML+SQL+JDBC & Hibernate
二.OOA/D 与UML 部分:(共6 题:基础2 道,中等难度4 道) 96.UML 是什么?常用的几种图?[基础] 答:UML 是标准建模语言:常用图包括:用例图,静态图(包括类图.对象图和包图) ...
- [ZZ] 基于Matlab的标记分水岭分割算法
基于Matlab的标记分水岭分割算法 http://blog.sina.com.cn/s/blog_725866260100rz7x.html 1 综述 Separating touching obj ...
- Matlab中调用VS编译的exe文件并传递变量 的方法
经历::在网上找了很多方法,都没有实现在matlab中调用vs的exe文件并且能够传递变量参数,一些小细节花费了自己很多时间,比喻忽略了一些空格! 网上很多的方法都是纯粹复制别人的方法,自己都没有去 ...
- multiprocessing还是threading?
今夜看了一篇分析python中多进程与多线程优劣的文章,文章通过几组性能测试强调了多进程的性能优势,同时也深入分析了为何python中多线程性能较差的原因,GIL就是解释器全局锁,该机制限制每个pyt ...
- pytorch学习资料链接
2017年12月25日15:06:44 官方文档:http://pytorch.org/docs/master/index.html 官方文档中文翻译:https://pytorch-cn.readt ...
- ADB server didn't ACK failed to start daemon 5037
错误信息: C:\Users\lizy>adb devices adb devicesadb server is out of date. killing... ADB server didn ...
- shell脚本(一)
shell脚本(一) 定义:脚本就是一条条命令的堆积.常见脚本有:js asp,jsp,php,python Shell特点:简单易用高效 Shell分类:图形界面(gui shell) 命令行界面 ...
- MySQL学习笔记Windows篇<一> Welcome to MySQL
MySQL安装完毕后没有图形化操作界面,图形化管理界面需要另行安装,个人比较喜欢Navicat,界面更像SQLserver: 此篇学习笔记所有操作均使用命令行中完成: 1.开启/停止服务 使用MySQ ...
- Python3 timeit的用法
Python3中的timeit模块可以用来测试小段代码的运行时间 其中主要通过两个函数来实现:timeit和repeat,代码如下: def timeit(stmt="pass", ...
- PHPMailer出现SMTP connect() failed.
很可能是端口问题,最好把$mailer->SMTPSecure和$mailer->Port分别设置为ssl与465或者tls与587,否则某些浏览器不接受不安全的链接,导致$mailer- ...