TCCC '24 Apr P1 - Taxes, taxes!

View as PDF

Submit solution

Points: 3
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

Thornhill Computer Club 2024 - April Contest - Problem 1

An odd country taxes customers in stores for buying certain amounts of items, in order to encourage bulk buying:

Number different of items Tax cost
1 only $2
2 or 3 $1
4 or 5 $0.5
6 or more $0

Given the number of items purchased by a single customer and each of their prices, determine the final cost to buy the items.

Input Specification

The first line will contain an integer N (1 \le N \le 1000) representing the number of different items that the customer will buy.

The next N lines will consist of 2 space-separated integers, K (1 \le K \le 1000), the cost of the item, and L (1 \le L \le 1000), the amount of the item that the customer will buy.

Output Specification

On a single line, output the cost of the entire purchase.

Sample Input 1

2
5 8
8 1

Sample Output 1

49.0

Explanation for Sample Output 1

The customer wants to buy 8 $5 items, and they also want to buy 1 $8 item. This adds up to $40 + $8 = $48. Additionally, the customer wants to buy a total 2 items, so the store will charge $1 on top, so the final cost is $49.


Comments

There are no comments at the moment.