HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Repetition (Loops) > problem:


160. 50546 - Average Fuel Price

Guest
• Review clarifications (1)

Volume problems

• 147. 50553 - Divisible by m
• 148. 50596 - Your Ride Is Here (US...
• 148. 50596 - Your Ride Is Here (US...
• 150. 50763 - Valid Password
• 151. 50560 - Max Distance
• 153. 50368 - Right-most non zero d...
• 155. 50379 - a^b modulus k
• 158. 50404 - Sum of Self Powers
• 160. 50546 - Average Fuel Price
• 180. 50343 - The number of Ending...
• 30. 50764 - Fast Typing Competition

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Prepared by Ibrahim Mesecan.

Average Fuel Price

Shqip

Mr. Alban Shehu has bought a new car and he is curious about its fuel consumption. He has recorded his initial and final mileages at the top and then he gives his daily payments and the liter price of fuel. After his last day, he has placed a negative number to show the end of list. He wants to calculate the amount of fuel consumed in every 100kms and the average price for that.

The fuel consumption can be calculated:
   (Fuel consumption per 100kms) = (Total liters consumed) / (Total km's made) * 100
   (Average liter price) = (Total amount paid) / (total liters bought)
   (Average price per 100kms) = (Average Liter Price) * (Fuel consumption per 100kms)

Input specification
You will be first given two integer numbers showing the initial and final mileages where 1 < initial mileage < final mileage ≤ 1000.000. Then each of the following lines contains two floating point numbers, the amount of money paid and the liter price of the fuel for that day. There are at most 10.000 fuel entries, and every number is less than 100. The fuel entry ends with a negative number.

Output specification
You will give two numbers (Fuel consumption per 100kms) and the (Average price per 100kms). When comparing your result with the expected result the program uses:
    if (abs(yourCalculatedResult - expectedResult)>0.001) return ERROR;
to decide if given result is correct or not. That is, if the difference between your result and the exprected result is less than 0.001, it's assumed to be correctly calculated.

Sample Input:
15000 15500
25.5 1.7
17 1.7
18 1.8
-1

Input Explanation:
15000 15500 ==> initial and final mileages
25.5 1.7 ==> On the first day he paid $25.5 and the liter price of the fuel was $1.7
...

Sample Output:
7.0 12.1


Для отправки решений необходимо выполнить вход.

www.contester.ru