22746_Rancher'sGif

2022-5-16 18:22| 发布者: Hocassian| 查看: 21| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-5-89506917488200-Problem List-采集的数据-后羿采集器.html

Pro.ID

22746

Title

Rancher's Gift

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22746

AC

2

Submit

2

Ratio

100.00%

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    Rancher Joel has a tract of land in the shape of a convex quadrilateral that he wants to divide among his sons AL, Bob, Chas and Dave, who wish to continue ranching on their portions, and his daughter Emily, who wishes to grow vegetables on her portion.

    The center of the tract is most suitable for vegetable farming so Joel decides to divide the land by drawing lines from each corner(A, B, C, D in counter clockwise order) to the center of an opposing side (respectively A', B', C', and D'). Each son would receive one of the triangular sections and Emily would receive the central quadrilateral section. As shown in the figure, Al's tract is to be bounded by the line from A to B, the line from A to the midpoint of BC and the line from B to the midpoint of CD; Bob's tract is to be bounded by the line from B to C, the line from B to the midpoint of CD and the line from C to the midpoint of DA, and so on.

    Your job is to write a program that will help Rancher Joel determine the area of each child's tract and the length of the fence he will have to put around Emily's parcel to keep her brothers' cows out of her crops.

    For this problem, A will always be at (0, 0) and B will always be at(x, 0). Coordinates will be in rods (a rod is 16.5 feet). The returned areas should be in acres to 3 decimal places (an acre is 160 square rods) and the length of the fence should be in feet, rounded up to the next foot.

    输入

    The first line of input contains a single integer P, ( 1 ≤ P ≤ 1000 ), which is the number of data sets that follow. Each data set is a single line that contains of a decimal integer followed by five(5) space separated floating-point values. The first (integer) value is the data set number, N. The floating-point values are B.x, C.x, C.y, D.x and D.y in that order (where V.x indicates the x coordinate of V and V.y indicates the y coordinate of V). Recall that the y coordinate of B is always zero(0). The supplied coordinates will always specify a valid convex quadrilateral.

    输出

    Description

    Rancher Joel has a tract of land in the shape of a convex quadrilateral that he wants to divide among his sons AL, Bob, Chas and Dave, who wish to continue ranching on their portions, and his daughter Emily, who wishes to grow vegetables on her portion.

    The center of the tract is most suitable for vegetable farming so Joel decides to divide the land by drawing lines from each corner(A, B, C, D in counter clockwise order) to the center of an opposing side (respectively A', B', C', and D'). Each son would receive one of the triangular sections and Emily would receive the central quadrilateral section. As shown in the figure, Al's tract is to be bounded by the line from A to B, the line from A to the midpoint of BC and the line from B to the midpoint of CD; Bob's tract is to be bounded by the line from B to C, the line from B to the midpoint of CD and the line from C to the midpoint of DA, and so on.

    Your job is to write a program that will help Rancher Joel determine the area of each child's tract and the length of the fence he will have to put around Emily's parcel to keep her brothers' cows out of her crops.

    For this problem, A will always be at (0, 0) and B will always be at(x, 0). Coordinates will be in rods (a rod is 16.5 feet). The returned areas should be in acres to 3 decimal places (an acre is 160 square rods) and the length of the fence should be in feet, rounded up to the next foot.

    Input

    The first line of input contains a single integer P, ( 1 ≤ P ≤ 1000 ), which is the number of data sets that follow. Each data set is a single line that contains of a decimal integer followed by five(5) space separated floating-point values. The first (integer) value is the data set number, N. The floating-point values are B.x, C.x, C.y, D.x and D.y in that order (where V.x indicates the x coordinate of V and V.y indicates the y coordinate of V). Recall that the y coordinate of B is always zero(0). The supplied coordinates will always specify a valid convex quadrilateral.

    Output

    For each data set there is a single line of output. It contains the data set number, N, followed by a single space followed by five(5) space separated floating point values to three(3) decimal place accuracy, followed by a single space and a decimal integer. The floating-point values are the areas in acres of the properties of AI, Bob, Chas, Dave, and Emily respectively. The final integer is the length of fence in feet required to fence in Emily's property (rounded up to next foot).

    Sample Input

    3
    1 200 250 150 -50 200
    2 200 200 100 0 100
    3 201.5 157.3 115.71 -44.2 115.71

    Sample Output

    1 35.000 54.136 75.469 54.167 54.666 6382
    2 25.000 25.000 25.000 25.000 25.000 4589
    3 29.144 29.144 29.144 29.144 29.144 4937

    Source

    样例输入

    3
    1 200 250 150 -50 200
    2 200 200 100 0 100
    3 201.5 157.3 115.71 -44.2 115.71

    样例输出

    1 35.000 54.136 75.469 54.167 54.666 6382
    2 25.000 25.000 25.000 25.000 25.000 4589
    3 29.144 29.144 29.144 29.144 29.144 4937

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部