HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Functions > problem:


080. 50347 - Selling Oranges

Guest
• Review clarifications (1)

Volume problems

• 050. 50510 - What floor are they?
• 050. 50566 - Grade Point Average (...
• 060. 50727 - Fibonacci Numbers
• 061. 50733 - The Highest Average
• 062. 50390 - Total Salary Paid
• 066. 50523 - Total Tax to Pay
• 070. 50534 - Top Trading Company
• 076. 50289 - Monthly Allowance
• 080. 50347 - Selling Oranges
• 090. 50378 - Sum of the given digits
• 095. 50453 - The Cubic Difference
• 100. 50397 - The Number of Points ...
• 110. 50409 - Random Password Ge...
• 120. 50684 - Sum of prime numbers...
• 125. 50578 - Mersenne prime
• 130. 50652 - Prime Factorization
• 132. 50474 - Sum of Two Primes

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.
Question by Ibrahim Mesecan.

Selling Oranges

Mr. Ilir Dardani produces oranges and export them. When exporting he puts the oranges into bins (buckets) according to their sizes. Thus according to their sizes the prices change.

The size of oranges vary, usually upto 15cms. They are put into m bins with the sizes b1, b2, b3..., bm. And it's known that the bin sizes are in increasing order. An orange fits into bini if its size is greater than or equal to bini but is less than bini+1. Mr. Dardani wants to put all oranges to the biggest bin that they fit.

Question:
Write a program that is going to read bin and orange information and calculate the total sell price.

Input specification
There are two numbers at the beginning: the number of bins (m) and the number of oranges (n) where 1 ≤ m ≤ 10 and 1 ≤ n ≤ 50000. The following m lines give the size of bins followed by price of each orange in that bin, whe size of bins are between 1 and 15 and price of each orange is $0.10 and $2.50. The following line gives n positive floating point numbers between 1 and 15.

Output specification
Show the total sell price.

Sample Input I
  3 6
  1 0.3
  6 0.8
  12 1.5
  12.4 6.8 14 5 4.7 9
Sample Input II
  5 10
  1 0.3
  3 0.5
  6 0.8
  9 1
  12 1.5
  5 3 8.2 9.1 6 9 1 10 15 4.6
Sample Output I
  5.2
Sample Output II
  7.9


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

www.contester.ru