22804_Balance

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

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

Pro.ID

22804

Title

Balance

Title链接

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

AC

1

Submit

1

Ratio

100.00%

时间&空间限制

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

    A sailboat has many forces acting onit. This allows it to sail in many different directions, even if the wind isnot blowing in the desired direction. In order for the boat to be easilycontrolled, however, certain forces must be balanced.

    Suppose the wind is blowing from thenorth and the boat is facing west. Above the water, the blowing wind hits thesails, and because of the way that they are angled, pushes the boat to thesouthwest. The keel extends deep below the water. The water resistance on thekeel creates a counterforce pushing the boat northward. Ideally, the northwardforce on the keel will counteract the southward component of the force on thesails, so that the boat will move to the west.

    A problem can arise if the centre ofthe sails (called the Centre of Effort, or CE) is not directly above the centreof the keel (called the Centre of Lateral Resistance, or CLR). In general, theboat can pivot about the centre of the keel. If the sails are too far forwardof the keel, the wind will push the bow (the front) of the boat southwards, andthe boat will turn towards the south. If the sails are too far aft of (behind)the keel, the wind will push the stern (the back) southwards, and the boat willturn towards the north. Ideally, the sails and keel are balanced so that theboat sails in a straight line.

    In this problem, you will examine a side view of theboat to determine whether the CE is above the CLR. The CE is defined as thecentroid of the part of the boat above the waterline. The CLR is defined as thecentroid of the part of the boat below the waterline. The centroid of a polygonis the unique point such that any line passing through it divides the polygoninto two halves of equal area.

    输入

    The first line of input will contain asingle integer n specifying thenumber of points along the outline of the side view of the boat. The followingn lines will each contain two integers: the x and y coordinate of apoint along the outline. The points will be given in order along the outline.The x axis (i.e. the line y = 0)represents the waterline. Assume that the boat faces in the direction ofincreasing x coordinates.

    输出

    Description

    A sailboat has many forces acting onit. This allows it to sail in many different directions, even if the wind isnot blowing in the desired direction. In order for the boat to be easilycontrolled, however, certain forces must be balanced.

    Suppose the wind is blowing from thenorth and the boat is facing west. Above the water, the blowing wind hits thesails, and because of the way that they are angled, pushes the boat to thesouthwest. The keel extends deep below the water. The water resistance on thekeel creates a counterforce pushing the boat northward. Ideally, the northwardforce on the keel will counteract the southward component of the force on thesails, so that the boat will move to the west.

    A problem can arise if the centre ofthe sails (called the Centre of Effort, or CE) is not directly above the centreof the keel (called the Centre of Lateral Resistance, or CLR). In general, theboat can pivot about the centre of the keel. If the sails are too far forwardof the keel, the wind will push the bow (the front) of the boat southwards, andthe boat will turn towards the south. If the sails are too far aft of (behind)the keel, the wind will push the stern (the back) southwards, and the boat willturn towards the north. Ideally, the sails and keel are balanced so that theboat sails in a straight line.

    In this problem, you will examine a side view of theboat to determine whether the CE is above the CLR. The CE is defined as thecentroid of the part of the boat above the waterline. The CLR is defined as thecentroid of the part of the boat below the waterline. The centroid of a polygonis the unique point such that any line passing through it divides the polygoninto two halves of equal area.

    Input

    The first line of input will contain asingle integer n specifying thenumber of points along the outline of the side view of the boat. The followingn lines will each contain two integers: the x and y coordinate of apoint along the outline. The points will be given in order along the outline.The x axis (i.e. the line y = 0)represents the waterline. Assume that the boat faces in the direction ofincreasing x coordinates.

    Output

    If the CE is forward of the CLR, print the line:

    CE is forward of CLR by N units.

    If the CE is after of (behind) the CLR, print the line:

    CE is aft of CLR by N units.

    In both cases, replace the N with the difference in the x coordinates of the CE and CLR to two decimal places. If the x coordinates of the CE and CLR are equal, print the line:

    Balanced.

    Sample Input

    7
    0 1
    2 3
    4 1
    4 -3
    2 -3
    2 -1
    0 -1

    Sample Output

    CE is aft of CLR by 0.50 units.

    Source

    样例输入

    7
    0 1
    2 3
    4 1
    4 -3
    2 -3
    2 -1
    0 -1

    样例输出

    CE is aft of CLR by 0.50 units.

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部