본문 바로가기

알고리즘 문제

Programmers Level 3 야근 지수

def noOvertime(n, works):

    result = 0

    while n>0:

        works[works.index(max(works))]-=1

        n-=1

    for i in works:

        result += i**2

    return result

print(noOvertime(4,[4,3,3]))