python26 백준 11508번 : 2+1 세일 링크 : https://www.acmicpc.net/problem/11508 11508번: 2+1 세일 KSG 편의점에서는 과일우유, 드링킹요구르트 등의 유제품을 '2+1 세일'하는 행사를 하고 있습니다. KSG 편의점에서 유제품 3개를 한 번에 산다면 그중에서 가장 싼 것은 무료로 지불하고 나머지 두 www.acmicpc.net N = int(input()) price = [] for i in range(0,N): x = int(input()) price.append(x) pay = 0 price.sort() while len(price) >= 3: x1 = int(price.pop()) x2 = int(price.pop()) x3 = int(price.pop()) pay = pay + x1 + x2 .. 2022. 1. 2. 백준 1758번 : 알바생 강호 링크 : https://www.acmicpc.net/problem/1758 1758번: 알바생 강호 첫째 줄에 스타박스 앞에 서 있는 사람의 수 N이 주어진다. N은 100,000보다 작거나 같은 자연수이다. 둘째 줄부터 총 N개의 줄에 각 사람이 주려고 하는 팁이 주어진다. 팁은 100,000보다 작거나 같 www.acmicpc.net N = int(input()) n = [] for _ in range(N): _x = int(input()) n.append(_x) n.sort(reverse = True) tip=0 for i in range(1, len(n)+1): if n[i-1]-(i-1) >=0: tip = tip + (n[i-1]-(i-1)) else: tip += 0 print(tip) 최대.. 2022. 1. 2. 이전 1 ··· 4 5 6 7 다음