포럼
문제 ICPC00360

G. Grocery Greed

설명

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 form[1] with exactly two decimal places. [1] When 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
출력
8.89
예제 2
입력
5
20.43 1.11 6.47 19.99 3.75
출력
51.70
예제 3
입력
2
0.05 0.14
출력
0.19
예제 4
입력
4
1.00 3.00 5.00 2.00
출력
11.00
예제 5
입력
3
68.79 61.18 0.58
출력
130.53
문제 정보

생성자가 기록되지 않았습니다.

출처 ICPC BAPC 2024

평가 및 의견

G. Grocery Greed

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 1 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

G. Grocery Greed

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8