学习笔记4

Snooker

题目链接

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 hasthe 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/ afterthe 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 colorballs must be on board either). So suppose Philp can continuesly hit the ball into the hole, he can get the maximun score is12 * 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

让我明白了英语很重要!!!em...没翻译没法看懂,做的资格都没有......

这是金山翻译的:

背景:菲利普喜欢玩斯诺克QQ游戏时,他想放松,虽然他只是一个小菜鸟。也许你还没玩过那个游戏,不管怎么样,我先给你介绍一下规则。船上有21个物体球,包括15个红色球和6个彩色球:黄色、绿色、棕色、蓝色、粉红色、黑色。球员应使用白色主球使目标球滚进洞内,球在洞内的固定值之和是球员的得分。球员首先要把一个红色的球打入洞内,然后得到红球的值(1分),然后他就有机会制造一个彩色球,然后交替进行。彩球应该取出,直到所有的红球都在洞里.换句话说,如果船上只剩下颜色的球,球员应该按这样的顺序击球:黄色(2分),绿色(3分),棕色(4分),蓝色(5分),粉红色(6分),黑色(7分),在球被打进洞后,他们是出不了洞的,在没有球的情况下,比赛结束后,得分较高的球员赢得了比赛。PS:红色物体球永远出不了洞。我只是举例说明可能使用的规则,如果您想联系更多细节,请在比赛结束后访问http://sports.tom.com/snooker/。例如,如果船上有12个红色球(如果仍然有红色球留在船上,则可以确保所有颜色的球都必须在船上)。所以假设菲尔普能连续地把球打进洞里,他的最大得分是12*1(一次射门中有12颗红球)7*12(击中红球后,最有价值的黑球应该是目标)2 3 4 5 6 7(当没有红球的时候,把所有的彩球都打到洞里)。现在,你的任务是判断菲利普是否应该在告诉你船上的情况时做出放弃的决定(还有多少物体球还没有在洞里,还有其他球员的得分)。如果菲尔普仍然有机会赢,只要打印“是”,否则打印“否”。(PS:如果他能得到的最大分数加上他目前的得分等于对手目前的得分,那么仍然输出“是”)

主要问题就是翻译,题目说的十分清楚,算是一道普通正常的题目.

思路:

斯诺克规则是总共有15个红球和6个彩球,打球顺序为打一个红球,进球得1分,

再打一个彩球,进球得彩球颜色相应分值(黄2 绿3 棕4 蓝5 粉6 黑7)。给你桌上还剩的球数、

A当前的比分,对手B当前的比分。假如A能将桌上还剩的球数都打进,问他是否能获胜。

代码:

#include"stdio.h"

#include"string.h"

int A[1000000];

int main()

{

int n;

int i;

A[0]=7%3;

A[1]=11%3;

for(i=2;i<1000000;i++)

A[i]=(A[i-1]+A[i-2])%3;

while(scanf("%d",&n)!=-1)

printf("%s\n",A[n]==0?"yes":"no");

return 0;

}

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 217,907评论 6 506
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 92,987评论 3 395
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 164,298评论 0 354
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 58,586评论 1 293
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 67,633评论 6 392
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,488评论 1 302
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,275评论 3 418
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 39,176评论 0 276
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,619评论 1 314
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,819评论 3 336
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,932评论 1 348
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,655评论 5 346
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,265评论 3 329
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,871评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,994评论 1 269
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 48,095评论 3 370
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,884评论 2 354

推荐阅读更多精彩内容