编程介的小学生 2016-10-23 15:00 采纳率: 20.5%
浏览 846
已采纳

Bullseye 好难,问题都看不懂

Problem
A simple dartboard consists of a flat, circular piece of cork with concentric rings drawn on it. Darts are thrown at the board by players in an attempt to hit the center of the dartboard (the Bullseye). The region between each pair of rings (or the center and the first ring) represents a certain point value. The closer the region is to the center of the dartboard, the more points the region is worth, as shown in the diagram below:

技术分享

Ring radii are at 3", 6", 9", 12" and 15" (the Bullseye has a diameter of 6"). A game of Simple Darts between two players is played as follows. The first player throws 3 darts at the board. A score is computed by adding up the point values of each region that a dart lands in. The darts are removed. The second player throws 3 darts at the board; the score for player two is computed the same way as it is for player one. The player with the higher score wins.

For this problem, you are to write a program that computes the scores for two players, and determine who, if anyone, wins the game. If a dart lands exactly on a ring (region boundary), the higher point value is awarded. Any dart outside the outer ring receives no points. For the purposes of this problem, you can assume that a dart has an infinitely fine point and can not land partially on a ring; it is either on the ring or it is not on the ring. Standard double precision floating point operations will be should be used.

Input

Input consists of 1 or more datasets. A dataset is a line with 12 double-precision values separated by spaces. Each pair of values represents the X and Y distances respectively of a dart from the center of the board in inches. (the center is located at X=0, Y=0. The range of values are: -20.0 ≤ X,Y ≤ 20.0. Player one‘s darts are represented by the first 3 pairs of values, and player two‘s by the last 3 pairs of values. Input is terminated by the first value of a dataset being -100.

Output

For each dataset, print a line of the form:

SCORE: N to M, PLAYER P WINS.
Or:
SCORE: N to M, TIE.
N is player one‘s score, and M is player two‘s score. P is either 1 or 2 depending on which player wins. All values are non-negative integers.

Formula

Recall: r2 = x2 + y2 where r is the radius, and (x, y) are the coordinates of a point on the circle.

Sample Input

-9 0 0 -4.5 -2 2 9 0 0 4.5 2 -2
-19.0 19.0 0 0 0 0 3 3 6 6 12 12
-100 0 0 0 0 0 0 0 0 0 0 0
Sample Output

SCORE: 240 to 240, TIE.
SCORE: 200 to 140, PLAYER 1 WINS.

  • 写回答

2条回答 默认 最新

  • threenewbee 2016-10-23 15:01
    关注

    你提的很多问题,google下就有。

    http://www.cnblogs.com/QingHuan/p/4253546.html

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥85 maple软件,solve求反函数,出现rootof怎么办?
  • ¥15 求chat4.0解答一道线性规划题,用lingo编程运行,第一问要求写出数学模型和lingo语言编程模型,第二问第三问解答就行,我的ddl要到了谁来求了
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题