HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Arithmetic > problem:


50546 - Average Fuel Price

Guest
• Review clarifications (1)

Section problems

• 50637 - Number systems
• 50650 - Prime numbers
• 50652 - Prime Factorization
• 50653 - Long Divide
• 50661 - nth Power of a Digit
• 50662 - Prime numbers (2)
• 50684 - Sum of prime numbers fro...
• 50548 - Albanian Airlines
• 50546 - Average Fuel Price

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