学习笔记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;

}

你可能感兴趣的:(学习笔记4)