21286_Range

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

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

Pro.ID

21286

Title

Range

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

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

    Some automobiles display the estimated driving range, that is, the distance you can expect to drive it (without adding fuel) before running out of fuel. Here is how it works: periodically, the vehicle's computer records the odometer reading and the weight of fuel in the fuel tank. From this data, the fuel consumption over a certain distance can be computed. From the fuel consumption and the most recent measurement of fuel tank contents (which we assume is current for all practical purposes), the range can be calculated.

    Intervals over which the quantity of fuel increased (fuel was added to the tank) will not be used in the computations. For example, in the first problem instance of the sample input, the interval where the fuel weight increased from 29.9 kilograms to 34.2 kilograms will not be used. In this example, 16.3 kilograms of fuel were consumed over a distance of 228.6 kilometers. Therefore, the most recently measured fuel contents of 31.2 kilograms will enable you to drive another 438 kilometers (rounded to the nearest integer). The input will always contain at least one interval (two consecutive lines of input) where no fuel was added to the tank.

    输入

    The input contains data for a number of problem instances. Each problem instance consists of three or more (odometer reading, fuel weight) pairs, one pair per line. Distances are measured in kilometers and fuel weight in kilograms. All input numbers will be given to one decimal place.

    The end of each problem instance will be signaled by a (0.0, 0.0) pair. The last problem instance will be followed by a (-1.0, -1.0) pair.

    输出

    Description

    Some automobiles display the estimated driving range, that is, the distance you can expect to drive it (without adding fuel) before running out of fuel. Here is how it works: periodically, the vehicle's computer records the odometer reading and the weight of fuel in the fuel tank. From this data, the fuel consumption over a certain distance can be computed. From the fuel consumption and the most recent measurement of fuel tank contents (which we assume is current for all practical purposes), the range can be calculated.

    Intervals over which the quantity of fuel increased (fuel was added to the tank) will not be used in the computations. For example, in the first problem instance of the sample input, the interval where the fuel weight increased from 29.9 kilograms to 34.2 kilograms will not be used. In this example, 16.3 kilograms of fuel were consumed over a distance of 228.6 kilometers. Therefore, the most recently measured fuel contents of 31.2 kilograms will enable you to drive another 438 kilometers (rounded to the nearest integer). The input will always contain at least one interval (two consecutive lines of input) where no fuel was added to the tank.

    Input

    The input contains data for a number of problem instances. Each problem instance consists of three or more (odometer reading, fuel weight) pairs, one pair per line. Distances are measured in kilometers and fuel weight in kilograms. All input numbers will be given to one decimal place.

    The end of each problem instance will be signaled by a (0.0, 0.0) pair. The last problem instance will be followed by a (-1.0, -1.0) pair.

    Output
    For each problem instance, print the range, rounded to the nearest integer.
    Sample Input
    18400.5 43.2
    18440.4 40.4
    18482.7 37.0
    18540.2 33.1
    18585.3 29.9
    18620.8 34.2
    18664.6 31.2
    0.0 0.0
    18400.5 43.2
    18440.4 40.4
    18482.7 37.0
    18540.2 33.1
    18585.3 29.9
    0.0 0.0
    -1.0 -1.0
    Sample Output
    438
    415
    Source

    样例输入

    18400.5 43.2
    18440.4 40.4
    18482.7 37.0
    18540.2 33.1
    18585.3 29.9
    18620.8 34.2
    18664.6 31.2
    0.0 0.0
    18400.5 43.2
    18440.4 40.4
    18482.7 37.0
    18540.2 33.1
    18585.3 29.9
    0.0 0.0
    -1.0 -1.0

    样例输出

    438
    415

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部