HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Arithmetic > problem:


50546 - Average Fuel Price

Guest
• Review clarifications (1)

Section problems

• 50579 - Pentagonal Numbers
• 50584 - Total invoice amount
• 50634 - Perfect numbers
• 50635 - Decomposition into terms
• 50652 - Prime Factorization
• 50653 - Long Divide
• 50662 - Prime numbers (2)
• 50684 - Sum of prime numbers fro...
• 50546 - Average Fuel Price
• 50247 - Missing numbers
• 50301 - Fractions to Decimals
• 50332 - Variance of a series
• 50342 - 100 Factorial
• 50338 - Convert Into Decimal
• 50343 - The number of Ending Zero...
• 50557 - nth Power of m (Long Multiply)
• 50637 - Number systems

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