Pro.ID21078 TitleI-Soar Title链接http://10.20.2.8/oj/exercise/problem?problem_id=21078 AC0 Submit0 Ratio- 时间&空间限制描述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 输出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 Output For each data set, print one line of the form The total planting length is ## where ## Sample Input 100.0 Sample Output The total planting length is 80.0 Source 样例输入100.0 样例输出The total planting length is 80.0 作者 |