## LCC '18 Contest 5 S2 - Penny Pinching

View as PDF

Points: 7 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Since Canada has abolished the penny, purchase amounts have been rounded to the nearest 5 cents when paying cash. Fred, a very frugal shopper, has made use of this by breaking up his purchases so that the total amount he has to pay is as small as possible.

For example, if Fred wants to buy two items which cost $1.01 and$1.12, then he would rather buy those items separately and pay $1.00 +$1.10 = $2.10 rather than buying them together and paying$2.15.

Inspired by Fred’s idea, you have decided to turn his process into a program: given a set of prices, what is the minimum amount that you would have to pay if you split up the items correctly?

#### Input Specification

The first line of input contains an integer , the number of items. The next line contains space-separated item prices .

#### Output Specification

Output the minimum amount required to purchase all of the items.

#### Sample Input 1

2
1.01 1.12

#### Sample Output 1

2.10

#### Sample Input 2

4
1.01 2.02 3.03 4.04

#### Sample Output 2

10.05