From b7f11bb14cd4eb99687ee83f39d85902683043c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=84=9D=EC=88=98=EB=AF=BC?= Date: Mon, 28 Oct 2024 17:49:22 +0900 Subject: [PATCH 1/5] =?UTF-8?q?1=EB=B2=88=20=EB=AC=B8=EC=A0=9C=EC=9E=85?= =?UTF-8?q?=EB=8B=88=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/problem1.js | 53 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/src/problem1.js b/src/problem1.js index 9a14f2c..3eeb061 100644 --- a/src/problem1.js +++ b/src/problem1.js @@ -1,6 +1,53 @@ function problem1(pobi, crong) { - var answer; - return answer; -} + let Add = 0; + let Mul = 1; + let pobi_max; + let crong_max; + + if(pobi[0]!==pobi[1]-1 || crong[0]!==crong[1]-1) + return -1; + + function name(arr){ + for (let i=0; i<2; i++ ){ + let Max = 0; + + let n=arr[i].toString(); + + for(let j of n){ + Add += Number(j); + Mul *= Number(j); + } + if(Add>Mul) + arr[i]=Add; + + else + arr[i]=Mul; + + Add = 0; + Mul = 1; + } + + if(arr[0]>arr[1]) + Max = arr[0]; + else + Max = arr[1]; + + return Max; + + } + + pobi_max = name(pobi); + crong_max = name(crong); + + if(pobi_max>crong_max) + return 1; + else if(crong_max>pobi_max) + return 2; + else if(crong_max==pobi_max) + return 0; + + +} + module.exports = problem1; From 071fef9abad0aee58ef7c31fd4bf6912d918578e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=84=9D=EC=88=98=EB=AF=BC?= Date: Mon, 28 Oct 2024 17:49:40 +0900 Subject: [PATCH 2/5] =?UTF-8?q?2=EB=B2=88=20=EB=AC=B8=EC=A0=9C=EC=9E=85?= =?UTF-8?q?=EB=8B=88=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/problem2.js | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/problem2.js b/src/problem2.js index cebd07c..cba97a2 100644 --- a/src/problem2.js +++ b/src/problem2.js @@ -1,6 +1,29 @@ function problem2(cryptogram) { - var answer; - return answer; + + let arr = cryptogram.split(""); + var cnt; + + while(true){ + + let cnt = true; + + for(let i=0;i Date: Mon, 28 Oct 2024 17:50:03 +0900 Subject: [PATCH 3/5] =?UTF-8?q?3=EB=B2=88=20=EB=AC=B8=EC=A0=9C=EC=9E=85?= =?UTF-8?q?=EB=8B=88=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/problem3.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/problem3.js b/src/problem3.js index 1baed28..48a0997 100644 --- a/src/problem3.js +++ b/src/problem3.js @@ -1,6 +1,22 @@ function problem3(number) { - var answer; - return answer; + + let cnt=0; + for(let i=1;i<=number;i++){ + let arr=i.toString().split(""); + for(let j=0;j Date: Mon, 28 Oct 2024 17:50:28 +0900 Subject: [PATCH 4/5] =?UTF-8?q?4=EB=B2=88=20=EB=AC=B8=EC=A0=9C=EC=9E=85?= =?UTF-8?q?=EB=8B=88=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/problem4.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/problem4.js b/src/problem4.js index ee1d3bd..b93a28c 100644 --- a/src/problem4.js +++ b/src/problem4.js @@ -1,6 +1,18 @@ function problem4(word) { - var answer; - return answer; + let arr = Array.from(word); + +for (let i = 0; i < arr.length; i++) { + let ascii = arr[i].charCodeAt(0); + if (ascii >= 65 && ascii <= 90) { + arr[i] = String.fromCharCode(155 - ascii); + } else if (ascii >= 97 && ascii <= 122) { + arr[i] = String.fromCharCode(219 - ascii); + } +} + +let result = arr.join(''); +return result; + } module.exports = problem4; From 22e38f9d37077b7138f52c8e6b4f96ae4498d7f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=84=9D=EC=88=98=EB=AF=BC?= Date: Mon, 28 Oct 2024 17:50:42 +0900 Subject: [PATCH 5/5] =?UTF-8?q?5=EB=B2=88=20=EB=AC=B8=EC=A0=9C=EC=9E=85?= =?UTF-8?q?=EB=8B=88=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/problem5.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/problem5.js b/src/problem5.js index 9368e87..1431094 100644 --- a/src/problem5.js +++ b/src/problem5.js @@ -1,6 +1,17 @@ function problem5(money) { - var answer; - return answer; + let arr = [50000, 10000, 5000, 1000, 500, 100, 50, 10, 1]; + let result = []; + + + + for(let i of arr){ + result.push(Math.floor(money/i)); + money = money % i; + + } + + return result; + } module.exports = problem5;