Skip to content

Commit

Permalink
add (programmers - level1 1문제): js 풀이
Browse files Browse the repository at this point in the history
  • Loading branch information
padosum committed Dec 16, 2022
1 parent e34d48d commit 60ec8fa
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions programmers/level1/콜라 문제.js
@@ -0,0 +1,12 @@
function solution(a, b, n) {
let result = 0;

let remain = n;

while (remain >= a) {
const newBottleCount = Math.floor(remain / a) * b;
result += newBottleCount;
remain = newBottleCount + (remain % a);
}
return result;
}

0 comments on commit 60ec8fa

Please sign in to comment.