230824 부족한 금액 계산하기

Jongleee·2023년 8월 24일
0

TIL

목록 보기
346/576
public long solution(int price, int money, int count) {
	long totalCost = (long) price * count * (count + 1) / 2;
	return Math.max(totalCost - money, 0);
}

출처:https://school.programmers.co.kr/learn/courses/30/lessons/82612

0개의 댓글