HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > CEN111 Homeworks 2013-2015 > problem:


15-FallPr-70. 50814 - Buying Books from Internet

CEN111 Homeworks 2013-2015

Start: Jan.10.2015 at 10:00:00 AM
Finish: Jan.10.2015 at 03:00:00 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• 14-Spr2-50. 50437 - Age Labeling
• 15-FallHW-2. 50821 - Derivative of ...
• 15-FallHW-3. 50822 - Linked List
• 15-FallHW-4. 50823 - Secret Number
• 15-FallHW-5. 50824 - Sum of Group...
• 15-FallHW-6. 50825 - Drawing Polygon
• 15-FallPr-10. 50808 - Total Distance...
• 15-FallPr-50. 50812 - Total Discount...
• 15-FallPr-70. 50814 - Buying B...
• 15-FallPr-80. 50815 - Breaking the ...
• 15-FallRE-10. 50853 - Parking Place
• 15-FallRE-20. 50854 - Area of Trian...

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.

Buying Books from Internet

You want to buy books from internet. The companies offer different prices for the books and for shipping. They also offer different shipping price if you order more than one copies.

Question: Read the information for n orders and calculate total price to pay.

Input specification
First you will be given the number of orders (n) where n is between 0 and 5000. Then, in the following n lines you will be given information for n orders. Each order information contains four numbers

  1. The number of books: an integer between 1 and 10.
  2. Price of a book: a floating point number between 1 and 25.
  3. Shipping price for one book: a floating point number between 1 and 15
  4. Shipping price for multiple copies: a floating point number between 1 and 10

Output specification
Show one floating point number with two digits precision.

Sample Input
3
2 5.5 3 2
1 5.4 7.1 5.1
2 7.5 3.5 2
Sample Output
46.50

Explanation:

  • The first book has been ordered 2 copies: (5.5*2) + (2*2) = 15
  • The second book has been ordered only one copy: (5.4) + (7.1) = 12.5
  • The third book has been ordered 2 copies: (7.5*2) + (2*2) = 19
And the total is (15 + 12.5 + 19) 46.50



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

www.contester.ru