22129_JauntaroundtheZhuhaiCampus

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

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

Pro.ID

22129

Title

Jaunt around the Zhuhai Campus

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

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

    The 1st Annual Guangdong Collegiate Programming Contest (GDCPC) was held in Zhuhai Campus of Zhongshan (SunYat-Sen) University last year. And now we gather again for the 2nd GDCPC in the same wonderful place. After the contest, most of the participants will probably have a jaunt around the beautiful Campus.


    Figure 1

    As you have seen, the main attraction of this place is the green hills surrounding. And a problem comes up now. What is the area of cross section of the hills?

    This range of hills contains peaks and valleys. So before calculating the area, we have to firstly scale and write down the coordinates of the turning points. In the following graph, 7 turning points of a hill are marked.

    Figure 2

    输入

    The first line of the input is a positive integer T. T is the number of the test cases followed. The first line of each test cases contains only one positive integer N ( 1 < N <= 1000 ) which represents the number of the turning points. Then N lines follow and the i-th line contains two nonnegative integers Xi ( 0 <= Xi <= 10000 ), Yi ( 0 <= Yi <= 10000 ) which represent the coordinate of the i-th turning point. It is assumed that the given turning points is in X-coordinate increasing order, i.e. Xi < Xj when i < j.

    输出

    Description

    The 1st Annual Guangdong Collegiate Programming Contest (GDCPC) was held in Zhuhai Campus of Zhongshan (SunYat-Sen) University last year. And now we gather again for the 2nd GDCPC in the same wonderful place. After the contest, most of the participants will probably have a jaunt around the beautiful Campus.


    Figure 1

    As you have seen, the main attraction of this place is the green hills surrounding. And a problem comes up now. What is the area of cross section of the hills?

    This range of hills contains peaks and valleys. So before calculating the area, we have to firstly scale and write down the coordinates of the turning points. In the following graph, 7 turning points of a hill are marked.

    Figure 2

    Input
    The first line of the input is a positive integer T. T is the number of the test cases followed. The first line of each test cases contains only one positive integer N ( 1 < N <= 1000 ) which represents the number of the turning points. Then N lines follow and the i-th line contains two nonnegative integers Xi ( 0 <= Xi <= 10000 ), Yi ( 0 <= Yi <= 10000 ) which represent the coordinate of the i-th turning point. It is assumed that the given turning points is in X-coordinate increasing order, i.e. Xi < Xj when i < j.
    Output
    The output of the program should consist of one line of output for each test case. The output of each test case only contains one real number which represents the area of the cross section of the hills. The real numbers are rounded to one decimal digit. No redundant spaces are needed.
    Sample Input
    2
    2
    1 4
    3 4
    2
    2 7
    3 9
    Sample Output
    8.0
    8.0
    Source

    样例输入

    2
    2
    1 4
    3 4
    2
    2 7
    3 9

    样例输出

    8.0
    8.0

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部