首页 > 其他分享 >hdoj Snooker 2060 (水)

hdoj Snooker 2060 (水)

时间:2023-04-19 15:36:04浏览次数:45  
标签:ball score point Snooker balls 2060 hole red hdoj

Snooker Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 9639    Accepted Submission(s): 4083


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 //题意:输入n,a,b;n表示剩余几个球,a表示你的分数,b表示对手的分数, 斯诺克,有15个球9个红球,6个有色球,红球一个1分,有色球 yellow(2 point), green(3 point), brown(4 point), blue(5 point), pink(6 point), black(7 point),现在打球得分的规则是:每打进一个红球,接着得打进一个有色球(比如你打进一个红球,接着有打进一个黑球,那么你得分为8分),在红球没打完之前,打进的有色球得再将其拿出来,如果红球打完了,打进的有色球不必拿出来,现在告诉你的分数和对手的分数,如果你将剩下的球都打进,问你是否可以获得胜利,只要最终的a>=b,即为获胜。 一个水题,就是题太长,不好翻译。。。

#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<iostream>
#define INF 0x3f3f3f3f
#define ull unsigned long long
#define ll long long
#define IN __int64
#define N 10010
#define M 1000000007
using namespace std;
int a[20]={7,6,5,4,3,2,1,1,1,1,1,1,1,1,1};
int main()
{
	int t,n,m,b;
	scanf("%d",&t);
	while(t--)
	{
		scanf("%d%d%d",&n,&m,&b);
		for(int i=0;i<n;i++)
			m+=a[i];
		if(n>6)
			m+=(n-6)*7;
		if(m>=b)
			printf("Yes\n");
		else
			printf("No\n");
	}
	return 0;
}

标签:ball,score,point,Snooker,balls,2060,hole,red,hdoj
From: https://blog.51cto.com/u_16079508/6206435

相关文章

  • hdoj Simply Syntax 1433 (模拟)
    SimplySyntaxTimeLimit:2000/1000MS(Java/Others)    MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):409    AcceptedSubmission(s):202ProblemDescriptionInthelandofHedoniatheofficiallanguage......
  • hdoj 天气情况 1437 (打表&数学)
    天气情况TimeLimit:2000/1000MS(Java/Others)    MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):685    AcceptedSubmission(s):280ProblemDescription如果我们把天气分为雨天,阴天和晴天3种,在给定各种天气......
  • hdoj The sum problem 2058 (数学等差公式&技巧转换)
    ThesumproblemTimeLimit:5000/1000MS(Java/Others)    MemoryLimit:32768/32768K(Java/Others)TotalSubmission(s):21416    AcceptedSubmission(s):6287ProblemDescriptionGivenasequence1,2,3,......N,yourjob......
  • hdoj 简易版之最短距离 2083 (取中位数)水
    简易版之最短距离TimeLimit:1000/1000MS(Java/Others)    MemoryLimit:32768/32768K(Java/Others)TotalSubmission(s):15746    AcceptedSubmission(s):6979ProblemDescription寒假的时候,ACBOY要去拜访很多朋友,恰巧他所......
  • hdoj 素数回文 1431 (模拟)
    素数回文TimeLimit:2000/1000MS(Java/Others)    MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):16372    AcceptedSubmission(s):3621ProblemDescriptionxiaoou33对既是素数又是回文的数特别感兴趣。比如......
  • HDOJ2067_小兔的棋盘(卡塔兰数)
    小兔的棋盘TimeLimit:1000/1000MS(Java/Others)    MemoryLimit:32768/32768K(Java/Others)TotalSubmission(s):11339    AcceptedSubmission(s):5717ProblemDescription小兔的叔叔从外面旅游回来给她带来了一个礼物,小兔高兴地跑回自己的房间,拆开一......
  • HDOJ2091 空心三角形
    空心三角形TimeLimit:1000/1000MS(Java/Others)    MemoryLimit:32768/32768K(Java/Others)TotalSubmission(s):49528    AcceptedSubmission(s):13429ProblemDescription把一个字符三角形掏空,就能节省材料成本,减轻重量,但关键是为了追求另一种视觉效......
  • HDOJ1017 A Mathematical Curiosity
    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1017这个题目其实挺坑的。首先是N,应该挺多人纠结过这个N,N其实是blocks(块),一块有未知个cases。一个块的结束标志是0,0。然后是PE的问题,空格、空行,我也是被坑的好惨。这里应该是每个块之间有一个空行!也就是说,最后一个块是不......
  • HDOJ1799 循环多少次?
    循环多少次?TimeLimit:3000/1000MS(Java/Others)    MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):5459    AcceptedSubmission(s):2122ProblemDescription  我们知道,在编程中,我们时常需要考虑到时间复杂度,特别是对于循环的部分。例如,......
  • HDOJ1994 利息计算
    利息计算TimeLimit:2000/1000MS(Java/Others)    MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):6791    AcceptedSubmission(s):4634ProblemDescription为自行解决学费,chx勤工俭学收入10000元以1年定期存入银行,年利率为3.7%。利率按......