JAVA/프로그래머스
[프로그래머스/자바] 콜라 문제
동백05
2024. 1. 29. 13:32
https://school.programmers.co.kr/learn/courses/30/lessons/132267
class Solution {
public int solution(int a, int b, int n) {
int answer = 0;
int left = n;
while(left>=a){
answer += (left/a)*b;
left = (left%a)+(left/a)*b;
}
return answer;
}
}