From 440312f6b1f5c2ab9371ca2155be4481a367c0a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=EC=9D=B8=EC=84=B1?= Date: Sat, 24 May 2025 13:38:35 +0900 Subject: [PATCH 1/3] =?UTF-8?q?solve:=20=EA=B0=81=EB=8F=84=EA=B8=B0=20?= =?UTF-8?q?=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "Insung-Jo/\352\260\201\353\217\204\352\270\260.js" | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 "Insung-Jo/\352\260\201\353\217\204\352\270\260.js" diff --git "a/Insung-Jo/\352\260\201\353\217\204\352\270\260.js" "b/Insung-Jo/\352\260\201\353\217\204\352\270\260.js" new file mode 100644 index 0000000..1cd1818 --- /dev/null +++ "b/Insung-Jo/\352\260\201\353\217\204\352\270\260.js" @@ -0,0 +1,11 @@ +function solution(angle) { + if (typeof answer !== 'number') throw new Error('숫자를 입력하세요'); + let answer = 0; + + if(angle === 180) answer = 4; + if(angle > 90 && angle < 180) answer = 3; + if(angle === 90) answer = 2; + if(angle > 0 && angle < 90 ) answer = 1; + + return answer; +} \ No newline at end of file From 3b7355eba617331b91301328beb0943b161adb13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=EC=9D=B8=EC=84=B1?= Date: Sat, 24 May 2025 13:39:02 +0900 Subject: [PATCH 2/3] =?UTF-8?q?solve:=20=EC=96=91=EA=BC=AC=EC=B9=98=20?= =?UTF-8?q?=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\354\226\221\352\274\254\354\271\230.js" | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 "Insung-Jo/level_0/\354\226\221\352\274\254\354\271\230.js" diff --git "a/Insung-Jo/level_0/\354\226\221\352\274\254\354\271\230.js" "b/Insung-Jo/level_0/\354\226\221\352\274\254\354\271\230.js" new file mode 100644 index 0000000..21728d5 --- /dev/null +++ "b/Insung-Jo/level_0/\354\226\221\352\274\254\354\271\230.js" @@ -0,0 +1,15 @@ +function solution(skewerCount, drinkCount) { + const LAMB_SKEWER_PRICE = 12000; + const DRINK_PRICE = 2000; + const FREE_DRINK_THRESHOLD = 10; + const NO_SERVICE_COUNT = 0; + + if(typeof skewerCount !== 'number' || typeof drinkCount !== 'number') throw new Error('숫자를 입력해주세요.'); + if (n < 0 || k < 0) throw new Error('음수는 허용되지 않습니다.'); + + const drinkService = skewerCount >= FREE_DRINK_THRESHOLD ? Math.trunc(drinkCount / FREE_DRINK_THRESHOLD) : NO_SERVICE_COUNT; + + const total = skewerCount * LAMB_SKEWER_PRICE + drinkCount * DRINK_PRICE - drinkService * DRINK_PRICE; + + return total; +} \ No newline at end of file From 4ab856a84b2f37e455e4c1637ee7bd61f0e4cc9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=EC=9D=B8=EC=84=B1?= Date: Sat, 24 May 2025 13:45:49 +0900 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=EC=9D=BC=EB=B6=80=20=EC=A1=B0?= =?UTF-8?q?=EA=B1=B4=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../level_0/\354\226\221\352\274\254\354\271\230.js" | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git "a/Insung-Jo/level_0/\354\226\221\352\274\254\354\271\230.js" "b/Insung-Jo/level_0/\354\226\221\352\274\254\354\271\230.js" index 21728d5..0975d24 100644 --- "a/Insung-Jo/level_0/\354\226\221\352\274\254\354\271\230.js" +++ "b/Insung-Jo/level_0/\354\226\221\352\274\254\354\271\230.js" @@ -5,11 +5,11 @@ function solution(skewerCount, drinkCount) { const NO_SERVICE_COUNT = 0; if(typeof skewerCount !== 'number' || typeof drinkCount !== 'number') throw new Error('숫자를 입력해주세요.'); - if (n < 0 || k < 0) throw new Error('음수는 허용되지 않습니다.'); + if(skewerCount < 0 || drinkCount < 0) throw new Error('음수는 허용되지 않습니다.'); - const drinkService = skewerCount >= FREE_DRINK_THRESHOLD ? Math.trunc(drinkCount / FREE_DRINK_THRESHOLD) : NO_SERVICE_COUNT; + const drinkService = skewerCount >= FREE_DRINK_THRESHOLD ? Math.trunc(skewerCount / FREE_DRINK_THRESHOLD) : NO_SERVICE_COUNT; - const total = skewerCount * LAMB_SKEWER_PRICE + drinkCount * DRINK_PRICE - drinkService * DRINK_PRICE; + const result = skewerCount * LAMB_SKEWER_PRICE + drinkCount * DRINK_PRICE - drinkService * DRINK_PRICE; - return total; + return result; } \ No newline at end of file