Skip to content

Commit ce511f9

Browse files
authored
Merge pull request #96 from front-studium/sgoldenbird
`week23` 풀이 완료
2 parents 54527ea + 3c6ed56 commit ce511f9

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
function solution(hp) {
2+
const general = 5;
3+
const soldier = 3;
4+
const worker = 1;
5+
6+
const generalCount = Math.floor(hp / general);
7+
const soldierCount = Math.floor((hp % general) / soldier);
8+
const workerCount = ((hp % general) % soldier) / worker;
9+
10+
return generalCount + soldierCount + workerCount;
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
function solution(price) {
2+
if (price >= 500000) {
3+
return Math.floor(price * 0.8);
4+
} else if (price >= 300000) {
5+
return Math.floor(price * 0.9);
6+
} else if (price >= 100000) {
7+
return Math.floor(price * 0.95);
8+
} else {
9+
return price;
10+
}
11+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
function solution(array) {
2+
array.sort((a, b) => a - b);
3+
const mid = Math.floor(array.length / 2);
4+
return array[mid];
5+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
function solution(n) {
2+
const result = [];
3+
for (let i = 1; i <= n; i++) {
4+
if (i % 2 !== 0) result.push(i);
5+
}
6+
return result;
7+
}

0 commit comments

Comments
 (0)