#K46882. Total Fuel Requirement Calculation
Total Fuel Requirement Calculation
Total Fuel Requirement Calculation
You are given an integer n representing the number of segments (distances between consecutive cities), a list of n distances in kilometers, and an integer representing the fuel efficiency of a car in km/l. Your task is to compute the total fuel required for the trip using the formula:
$$\text{Fuel Required} = \frac{\text{Total Distance}}{\text{Fuel Efficiency}}$$
The result should be rounded to two decimal places.
Example: For n = 3, distances 50 60 70
, and fuel efficiency 10, the total fuel required is 18.00
liters.
inputFormat
The input is read from standard input and consists of three lines:
- The first line contains a single integer n — the number of segments.
- The second line contains n space-separated numbers representing the distances (in kilometers) between consecutive cities.
- The third line contains a single integer representing the fuel efficiency of the vehicle (in km/l).
outputFormat
Output a single number: the total fuel required for the trip, rounded to two decimal places. The output should be written to standard output.
## sample3
50 60 70
10
18.00