From 80b4d1f1d3d6401e42a63a70e1527b37380ae561 Mon Sep 17 00:00:00 2001 From: "[firstname lastname]" <[valid-email]> Date: Tue, 29 Nov 2022 22:58:34 +0900 Subject: [PATCH 1/6] =?UTF-8?q?[PGS]=20=EB=AC=B8=EC=9E=90=EC=97=B4=20?= =?UTF-8?q?=EB=8B=A4=EB=A3=A8=EA=B8=B0=20=EA=B8=B0=EB=B3=B8=20/=20Level=20?= =?UTF-8?q?1=20/=2020m?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyungHwan/Week05/1.js" | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 "\354\210\230\354\232\224\354\235\274/MyungHwan/Week05/1.js" diff --git "a/\354\210\230\354\232\224\354\235\274/MyungHwan/Week05/1.js" "b/\354\210\230\354\232\224\354\235\274/MyungHwan/Week05/1.js" new file mode 100644 index 00000000..5f6fed9b --- /dev/null +++ "b/\354\210\230\354\232\224\354\235\274/MyungHwan/Week05/1.js" @@ -0,0 +1,8 @@ +function solution(s) { + if (s.length !== 4 && s.length !== 6) + return false; + for (let i = 0; i < s.length; i++) { + if (isNaN(Number(s[i]))) return false; + } + return true; + } \ No newline at end of file From 0190a8a1f1c58413136755b7945f70ffe91822c6 Mon Sep 17 00:00:00 2001 From: "[firstname lastname]" <[valid-email]> Date: Tue, 29 Nov 2022 23:13:31 +0900 Subject: [PATCH 2/6] =?UTF-8?q?[PGS]=20=EC=95=BD=EC=88=98=EC=9D=98=20?= =?UTF-8?q?=EA=B0=9C=EC=88=98=EC=99=80=20=EB=8D=A7=EC=85=88=20/=20Level=20?= =?UTF-8?q?1=20/=209m=2051s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyungHwan/Week05/2.js" | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 "\354\210\230\354\232\224\354\235\274/MyungHwan/Week05/2.js" diff --git "a/\354\210\230\354\232\224\354\235\274/MyungHwan/Week05/2.js" "b/\354\210\230\354\232\224\354\235\274/MyungHwan/Week05/2.js" new file mode 100644 index 00000000..2e34740f --- /dev/null +++ "b/\354\210\230\354\232\224\354\235\274/MyungHwan/Week05/2.js" @@ -0,0 +1,7 @@ +function solution(left, right) { + let answer = 0; + + for(let i = left; i <= right; i++){ + Math.sqrt(i) % 1 === 0 ? answer += i : answer -= i; + } return -answer +} \ No newline at end of file From e31cea1015f65059f48bb21e1ce218e127f3b56e Mon Sep 17 00:00:00 2001 From: "[firstname lastname]" <[valid-email]> Date: Tue, 29 Nov 2022 23:21:27 +0900 Subject: [PATCH 3/6] =?UTF-8?q?[PGS]=20=EB=B6=80=EC=A1=B1=ED=95=9C=20?= =?UTF-8?q?=EA=B8=88=EC=95=A1=20=EA=B3=84=EC=82=B0=ED=95=98=EA=B8=B0=20/?= =?UTF-8?q?=20Level=201=20/=205m=2055s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyungHwan/Week05/3.js" | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 "\354\210\230\354\232\224\354\235\274/MyungHwan/Week05/3.js" diff --git "a/\354\210\230\354\232\224\354\235\274/MyungHwan/Week05/3.js" "b/\354\210\230\354\232\224\354\235\274/MyungHwan/Week05/3.js" new file mode 100644 index 00000000..44698723 --- /dev/null +++ "b/\354\210\230\354\232\224\354\235\274/MyungHwan/Week05/3.js" @@ -0,0 +1,8 @@ +function solution(price, money, count) { + let total = 0; + + for(let i = 0; i <= count; i++){ + total += price * i + } + return total > money ? total - money : 0; +} \ No newline at end of file From ab9ea342f6867e258114747eade4abfcfd3ae7ca Mon Sep 17 00:00:00 2001 From: "[firstname lastname]" <[valid-email]> Date: Tue, 29 Nov 2022 23:29:52 +0900 Subject: [PATCH 4/6] =?UTF-8?q?[PGS]=20=ED=96=89=EB=A0=AC=EC=9D=98=20?= =?UTF-8?q?=EB=8D=A7=EC=85=88=20/=20Level=201=20/=207m=2025s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyungHwan/Week05/4.js" | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 "\354\210\230\354\232\224\354\235\274/MyungHwan/Week05/4.js" diff --git "a/\354\210\230\354\232\224\354\235\274/MyungHwan/Week05/4.js" "b/\354\210\230\354\232\224\354\235\274/MyungHwan/Week05/4.js" new file mode 100644 index 00000000..b3d708e3 --- /dev/null +++ "b/\354\210\230\354\232\224\354\235\274/MyungHwan/Week05/4.js" @@ -0,0 +1,10 @@ +function solution(arr1, arr2) { + let answer = []; + for(let i = 0; i < arr1.length; i++){ + answer[i] = []; + for(let j = 0; j < arr1[i].length; j++){ + answer[i].push(arr1[i][j] + arr2[i][j]) + } + } + return answer; +} \ No newline at end of file From fbd9cc4fb749d705756d267baf92e7a520cfccbd Mon Sep 17 00:00:00 2001 From: "[firstname lastname]" <[valid-email]> Date: Tue, 29 Nov 2022 23:49:23 +0900 Subject: [PATCH 5/6] =?UTF-8?q?[PGS]=20=EC=A7=81=EC=82=AC=EA=B0=81?= =?UTF-8?q?=ED=98=95=20=EB=B3=84=EC=B0=8D=EA=B8=B0=20/=20Level=201=20/=201?= =?UTF-8?q?5m=2023s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyungHwan/Week05/5.js" | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 "\354\210\230\354\232\224\354\235\274/MyungHwan/Week05/5.js" diff --git "a/\354\210\230\354\232\224\354\235\274/MyungHwan/Week05/5.js" "b/\354\210\230\354\232\224\354\235\274/MyungHwan/Week05/5.js" new file mode 100644 index 00000000..f8d779bb --- /dev/null +++ "b/\354\210\230\354\232\224\354\235\274/MyungHwan/Week05/5.js" @@ -0,0 +1,9 @@ +process.stdin.setEncoding('utf8'); +process.stdin.on('data', data => { + const n = data.split(" "); + const a = Number(n[0]), b = Number(n[1]); + // console.log(a); + // console.log(b); + const answer = ('*'.repeat(a)+`\n`).repeat(b) + console.log(answer) +}); \ No newline at end of file From 245963e78fa56391d9b875b3459dd53c12ada330 Mon Sep 17 00:00:00 2001 From: "[firstname lastname]" <[valid-email]> Date: Wed, 30 Nov 2022 00:31:31 +0900 Subject: [PATCH 6/6] =?UTF-8?q?[PGS]=20=EC=B5=9C=EB=8C=80=EA=B3=B5?= =?UTF-8?q?=EC=95=BD=EC=88=98=EC=99=80=20=EC=B5=9C=EC=86=8C=EA=B3=B5?= =?UTF-8?q?=EB=B0=B0=EC=88=98=20/=20Level=201=20/=2038m?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyungHwan/Week05/6.js" | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 "\354\210\230\354\232\224\354\235\274/MyungHwan/Week05/6.js" diff --git "a/\354\210\230\354\232\224\354\235\274/MyungHwan/Week05/6.js" "b/\354\210\230\354\232\224\354\235\274/MyungHwan/Week05/6.js" new file mode 100644 index 00000000..147a7241 --- /dev/null +++ "b/\354\210\230\354\232\224\354\235\274/MyungHwan/Week05/6.js" @@ -0,0 +1,10 @@ +function solution(n, m) { + let answer = []; + + const gcd = (n, m) => { + if( m === 0) return n + return gcd(m, n % m) + } + const lcm = (n, m) => n * m / gcd(n,m) + return [gcd(n,m), lcm(n,m)] +} \ No newline at end of file