21078_I-Soar

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

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

Pro.ID

21078

Title

I-Soar

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

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

    The town meeting was not going well. "It's noisy", some town residents complained. "It's ugly", others stated. "It's an eyesore", many agreed. "It's here," said the mayor, "and it's not going to go away."

    The cause of all this furor was the new stretch of Interstate Highway that had been just opened. Straight as an arrow, it ran along the entire northern edge of the town.

    "Look," said the mayor, "we can reduce the noise and improve the view by planting trees and tall hedges along the road, but we don't have an unlimited budget. Luckily, much of the highway is already hidden by some of the buildings in our commercial district on the north. We'll see what we can do by planting in the visible gaps between the buildings."

    Write a program to compute the total linear length of planting that will be required to block the view of the Interstate by an observer looking straight north (orthogonal to the highway) from the southern side of the commercial district.

    输入

    Input consists of multiple data sets. The first line in each data set contains the length of the town border adjacent to the highway, expressed as a floating point number (called L, below). A nonpositive value for this number signals the end of input. This is followed by zero or more lines containing the positions of buildings within the commercial district. Each such line gives a pair of x positions (floating point numbers) representing the portion of the interstate whose view is occluded by the building. These numbers are expressed in the same units of measurement as the length of the border, such that 0 denotes the western end of the border and L the eastern end. The end of a data set is signaled by any pair x1, x2for which x1 > x2.

    输出

    Description

    The town meeting was not going well. "It's noisy", some town residents complained. "It's ugly", others stated. "It's an eyesore", many agreed. "It's here," said the mayor, "and it's not going to go away."

    The cause of all this furor was the new stretch of Interstate Highway that had been just opened. Straight as an arrow, it ran along the entire northern edge of the town.

    "Look," said the mayor, "we can reduce the noise and improve the view by planting trees and tall hedges along the road, but we don't have an unlimited budget. Luckily, much of the highway is already hidden by some of the buildings in our commercial district on the north. We'll see what we can do by planting in the visible gaps between the buildings."

    Write a program to compute the total linear length of planting that will be required to block the view of the Interstate by an observer looking straight north (orthogonal to the highway) from the southern side of the commercial district.

    Input

    Input consists of multiple data sets. The first line in each data set contains the length of the town border adjacent to the highway, expressed as a floating point number (called L, below). A nonpositive value for this number signals the end of input. This is followed by zero or more lines containing the positions of buildings within the commercial district. Each such line gives a pair of x positions (floating point numbers) representing the portion of the interstate whose view is occluded by the building. These numbers are expressed in the same units of measurement as the length of the border, such that 0 denotes the western end of the border and L the eastern end. The end of a data set is signaled by any pair x1, x2for which x1 > x2.

    Output

    For each data set, print one line of the form

    The total planting length is ##

    where ## is a floating point number, printed to one decimal place precision, denoting the total length of the Interstate visible between the buildings.

    Sample Input
    100.0
    20.0 30.0
    40.0 50.0
    1.0 0.0
    100.0
    20.0 30.0
    22.0 28.0
    1.0 0.0
    -1.0
    Sample Output
    The total planting length is 80.0
    The total planting length is 90.0
    Source

    样例输入

    100.0
    20.0 30.0
    40.0 50.0
    1.0 0.0
    100.0
    20.0 30.0
    22.0 28.0
    1.0 0.0
    -1.0

    样例输出

    The total planting length is 80.0
    The total planting length is 90.0

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部