https://programmers.co.kr/learn/courses/30/lessons/82612
ํ์ด
# ํ๋ก๊ทธ๋๋จธ์ค 1๋จ๊ณ - ๋ถ์กฑํ ๊ธ์ก ๊ณ์ฐํ๊ธฐ
def solution(price, money, count):
answer = 0
total = 0
for i in range(1, count+1):
total += price * i
if total > money:
answer = total - money
return answer