We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f46ea32 + bf7ccea commit 6aeb2bfCopy full SHA for 6aeb2bf
Insung-Jo/level_0/개미 군단.js
@@ -0,0 +1,24 @@
1
+function solution(hp) {
2
+ const ARCHER_ANT = 5;
3
+ const SOLDIER_ANT = 3;
4
+ const WORKER_ANT = 1;
5
+ const DEAD = 0;
6
+
7
+ let prey = hp;
8
+ let answer = 0;
9
10
+ while (prey > DEAD) {
11
+ if (prey >= ARCHER_ANT) {
12
+ prey -= ARCHER_ANT;
13
+ answer++;
14
+ } else if (prey >= SOLDIER_ANT) {
15
+ prey -= SOLDIER_ANT;
16
17
+ } else {
18
+ prey -= WORKER_ANT;
19
20
+ }
21
22
23
+ return answer;
24
+}
Insung-Jo/level_0/옷가게 할인 받기.js
@@ -0,0 +1,7 @@
+function solution(price) {
+ if (price >= 500000) return Math.floor(price - price * 0.2);
+ if (price >= 300000) return Math.floor(price - price * 0.1);
+ if (price >= 100000) return Math.floor(price - price * 0.05);
+ return price;
0 commit comments