HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Arithmetic > problem:


50296 - Total Discount Rate

Guest
• Review clarifications (1)

Section problems

• 50398 - Sum of kth Anti-diagonal
• 50651 - Largest power of two
• 50388 - Number of Armstrong Num...
• 50359 - Mode of a Series
• 50440 - Call Center
• 50353 - Cube of the Largest number
• 50336 - Buying Carpets
• 50295 - Weighted Average
• 50296 - Total Discount Rate
• 50289 - Monthly Allowance
• 50559 - Prime Factors of a Number
• 50568 - Body Mass Index Calculator
• 50579 - Pentagonal Numbers
• 50584 - Total invoice amount
• 50634 - Perfect numbers
• 50635 - Decomposition into terms
• 50652 - Prime Factorization

Feedback

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

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

Total Discount Rate

Mr. Dardani has a wholesale company. He frequently makes discounts of different rates according to several different criteria. He records all his sales in a file. In the file he keeps the actual prices and the discount rate. At the end of every month, he wants to see the total discount rate, which is calculated with the following formula

  totalDiscountRate = 100 - (Total Sale Price) / (Sum of Actual Price) * 100;

Write a program that is going to read all sale and discount information and then calculate the totalDiscountRate out of gross sale amount.

Input specification
There will be n lines of sale information. Every line will contain 2 float numbers (saleAmount and discountRate), where 1 ≤ n ≤ 10000, 0 ≤ saleAmount ≤ 10000 and 1 ≤ discountRate ≤ 100

  • saleAmount is the amount of the sale before discount
  • discountRate is the percentage of the discount

Output specification
Show one floating point number that gives the total discountRate.

      

  Sample Input:
   3
   100 7
   150 10
   200 5

  Sample Output:
   7.111

  Output Explanation  :

Item Nr.    Actual Price    Sale Price
1
100
93
2
150
135
3
200
190
 Sum of Actual Price  Total Sale Price
450
418


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

www.contester.ru