uploaded at 2022. 12. 16. 오전 1:09:37
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
// [문제 링크]: 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 c = 0;
|
||||
while(n >= a){
|
||||
c = n/a;
|
||||
n = n + c * (b - a);
|
||||
answer += c * b;
|
||||
System.out.println(answer);
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user