Logo
(追記) (追記ここまで)

32601번 - Grocery Greed 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB52323164.583%

문제

Recently, you have acquired the newest book in the self-help category: "Becoming A Professional Consumer", containing a wide variety of tips on how to buy as much as possible, while paying as little as possible. One of the things that you already discovered while reading the book is that you have been paying too much for your groceries all your life!

This works as follows: in a supermarket, you can decide to pay with card or with cash. If you pay with cash, the amount you have to pay gets rounded to the nearest multiple of 0ドル.05, and if you pay with card, it does not. So, depending on your groceries, it can be cheaper if you pay with the right method! You can minimize your spendings even further by splitting your groceries into multiple groups, and paying separately for every group.

You have already decided on a list of the things that you are going to buy, and you know their prices. What is the cheapest way to buy all these groceries?

입력

The input consists of:

  • One line with an integer $n$ (1ドル \leq n \leq 2 \cdot 10^5$), the number of items you want to buy.
  • One line with $n$ floating point numbers $p$ (0ドル.05 \leq p \leq 100.00$), the prices of the items in euros. Each price is given in decimal form1 with exactly two decimal places.

1When a floating-point number is written in decimal form, it is not in scientific notation.

출력

Output the minimal total amount of money you need to buy all the groceries, in euros. Your answer should have exactly two decimal places.

제한

예제 입력 1

3
0.59 5.21 3.10

예제 출력 1

8.89

예제 입력 2

5
20.43 1.11 6.47 19.99 3.75

예제 출력 2

51.70

예제 입력 3

2
0.05 0.14

예제 출력 3

0.19

예제 입력 4

4
1.00 3.00 5.00 2.00

예제 출력 4

11.00

예제 입력 5

3
68.79 61.18 0.58

예제 출력 5

130.53

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > Benelux Algorithm Programming Contest > BAPC 2024 G번

  • 문제를 만든 사람: Jorke de Vlas
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /