창고 정리

이세진·2022년 4월 15일
0

코테준비

목록 보기
28/87

생성일: 2022년 1월 21일 오후 4:50

구현 코드

# 창고 정리
import sys
#sys.stdin = open("input.txt", "rt")
l = int(input())
box = list(map(int, input().split()))
m = int(input())

for _ in range(m):
    maxValue = max(box)
    maxIndex = box.index(maxValue)
    box[maxIndex] -= 1
    minValue = min(box)
    minIndex = box.index(minValue)
    box[minIndex] += 1

print(max(box) - min(box))
profile
나중은 결코 오지 않는다.

0개의 댓글

관련 채용 정보