Hduoj2060 【水题】

来源:互联网 发布:淘宝最高级别店铺 编辑:程序博客网 时间:2024/06/06 07:02
/*SnookerTime Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6906    Accepted Submission(s): 2935Problem Descriptionbackground: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") InputThe 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. OutputYou should caculate the max score left Philp can gain, and judge whether he has the possiblity to win. Sample Input212 1 11 30 39 Sample OutputYesNo Authorzl Source校庆杯Warm Up */#include<stdio.h>int main(){int i , j, k, n, a, b, c;scanf("%d", &n);while(n--){scanf("%d%d%d", &a, &b, &c);if(b >= c)printf("Yes\n");else{if(a >= 6){b += 27+ (a-6) * 8; }else{for(i = 7; a > 0; i--, a--){b += i;}}if(b >= c)printf("Yes\n");elseprintf("No\n");}}return 0;} 

题意:有15个红球,和6种其他颜色的球个一个,每个球对应一种分值,每进一个球总分即加上该球的分值, 现要求先进红球,且每进一个红球即可进一个其它颜色的球,并且其它颜色的球进了以后还得拿出来重新使用,直到所有红球都用完后,开始进其它颜色的球,并且不再拿出。题目现给出剩余的球数以及玩家的现有成绩以及对家的总成绩,要求计算玩家的现有成绩加上剩下的球的总分值是否大于等于对家。

体会:该题主要考察的是英语阅读能力,稍有不慎,就会wa。

0 0
原创粉丝点击