国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Java > 正文

HDU 2060 JAVA

2019-11-06 07:20:55
字體:
來源:轉載
供稿:網友

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 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

import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner sc =new Scanner(System.in); int n = sc.nextInt(); while(n-->0){ int numball = sc.nextInt(); int A =sc.nextInt(); int B =sc.nextInt(); int piont = 0; if(numball>21||numball<0){ break; } if(numball<7){ int x=7; for(int i=0;i<numball;i++){ piont=piont+x;x--; } }else{ piont = (numball-6)*8+27; } if((A+piont)>=B){ System.out.println("Yes"); }else{ System.out.println("No"); } } }}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 张掖市| 西充县| 泽州县| 大埔县| 蒙阴县| 海伦市| 达日县| 河池市| 麻栗坡县| 息烽县| 翁源县| 中阳县| 清新县| 高雄县| 虹口区| 远安县| 灵川县| 台前县| 安乡县| 云霄县| 望江县| 泗洪县| 岱山县| 宜兴市| 凉城县| 中阳县| 新丰县| 迁安市| 阳江市| 鄂伦春自治旗| 襄汾县| 华池县| 五华县| 昌都县| 灵武市| 沙河市| 阿拉尔市| 喀什市| 绥阳县| 台州市| 视频|