Programming/Python & Data Structures
[Baekjoon/Python3] 11508번 2+1 세일
HooNeee
2020. 12. 7. 00:28
[Baekjoon/Python3] 11508번 2+1 세일
11508번: 2+1 세일
KSG 편의점에서는 과일우유, 드링킹요구르트 등의 유제품을 '2+1 세일'하는 행사를 하고 있습니다. KSG 편의점에서 유제품 3개를 한 번에 산다면 그중에서 가장 싼 것은 무료로 지불하고 나머지 두
www.acmicpc.net
n = int(input())
price = [int(input()) for i in range(n)]
price.sort(reverse=True)
total = 0
for i in range(n):
if i % 3 != 2:
total += price[i]
print(total)