From 46b4ad693198b478078b3dbb69284c3e889d51e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=84=9C=EC=A0=95?= <12211197@inha.edu> Date: Sun, 1 May 2022 20:20:58 +0900 Subject: [PATCH] =?UTF-8?q?js=201=EC=A3=BC=EC=B0=A8=20=EA=B3=BC=EC=A0=9C-?= =?UTF-8?q?=EB=B0=95=EC=84=9C=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bj10818.js | 8 ++++++++ bj10869.js | 10 ++++++++++ bj2438.js | 8 ++++++++ bj2557.js | 1 + bj2741.js | 9 +++++++++ bj2753.js | 8 ++++++++ bj3052.js | 11 +++++++++++ bj9498.js | 15 +++++++++++++++ 8 files changed, 70 insertions(+) create mode 100644 bj10818.js create mode 100644 bj10869.js create mode 100644 bj2438.js create mode 100644 bj2557.js create mode 100644 bj2741.js create mode 100644 bj2753.js create mode 100644 bj3052.js create mode 100644 bj9498.js diff --git a/bj10818.js b/bj10818.js new file mode 100644 index 0000000..75b8e5f --- /dev/null +++ b/bj10818.js @@ -0,0 +1,8 @@ +const input = require("fs").readFileSyns("/dev/stdin").toString().split("\n"); + +const count = input[0]; +const nums = input[1].split("").map(Number); + +nums.sort((a, b) => a - b); + +console.log(nums[0], nums[count - 1]); diff --git a/bj10869.js b/bj10869.js new file mode 100644 index 0000000..1276984 --- /dev/null +++ b/bj10869.js @@ -0,0 +1,10 @@ +let input = require("fs").readFileSync("dev/stdin").toString().split(" "); + +const num1 = Number(input[0]); +const num2 = Number(input[1]); + +console.log(num1 + num2); +console.log(num1 - num2); +console.log(num1 * num2); +console.log(Math.floor(num1 / num2)); +console.log(num1 % num2); diff --git a/bj2438.js b/bj2438.js new file mode 100644 index 0000000..e1d21b8 --- /dev/null +++ b/bj2438.js @@ -0,0 +1,8 @@ +let input = requre("fs").readFileSync("/dev/stdin").toString(); + +let star = " "; + +for (let i = 0; i < input; i++) { + star += "*"; + console.log(star); +} diff --git a/bj2557.js b/bj2557.js new file mode 100644 index 0000000..019c0f4 --- /dev/null +++ b/bj2557.js @@ -0,0 +1 @@ +console.log("Hello World!"); diff --git a/bj2741.js b/bj2741.js new file mode 100644 index 0000000..083cf02 --- /dev/null +++ b/bj2741.js @@ -0,0 +1,9 @@ +let input = Number(require("fs").readFileSync("/dev/stdin").toString()); + +let answer = " "; + +for (let i = 1; i <= input; i++) { + answer += i + "\n"; +} + +console.log(answer); diff --git a/bj2753.js b/bj2753.js new file mode 100644 index 0000000..570001e --- /dev/null +++ b/bj2753.js @@ -0,0 +1,8 @@ +let input = require("fs").readFileSync("dev/stdin").toString().split(" "); + +const A = Number(input[0]); + +if ((A % 4 === 0 && A % 100 !== 0) || A % 400 === 0) { + A = 1; +} +console.log(A); diff --git a/bj3052.js b/bj3052.js new file mode 100644 index 0000000..b64f42e --- /dev/null +++ b/bj3052.js @@ -0,0 +1,11 @@ +const fs = require("fs"); +const input = fs + .readFileSync("dev/stdin") + .toString() + .trim() + .split("\n") + .map((val) => +val); +const arr = input.map((el) => el % 42); +const set = new Set(arr); +const uniqueArr = [...set]; +console.log(uniqueARr.length); diff --git a/bj9498.js b/bj9498.js new file mode 100644 index 0000000..170c7fb --- /dev/null +++ b/bj9498.js @@ -0,0 +1,15 @@ +const fs = require("fs"); +const input = fs.readFileSync("/dev/stdin").toString(); +const score = pareInt(input); + +if (score >= 90) { + console.log("A"); +} else if (score >= 80) { + console.log("B"); +} else if (score >= 70) { + console.log("C"); +} else if (score >= 60) { + console.log("D"); +} else { + console.log("F"); +}