From 4ccd694da72a448860432206143a96a16996ebaf Mon Sep 17 00:00:00 2001 From: sohee Date: Sat, 30 Apr 2022 22:55:11 +0900 Subject: [PATCH] fe week1 work done --- bj10818.js | 24 ++++++++++++++++++++++++ bj10869.js | 9 +++++++++ bj2438.js | 13 +++++++++++++ bj2557.js | 1 + bj2741.js | 11 +++++++++++ bj2753.js | 8 ++++++++ bj3052.js | 14 ++++++++++++++ bj9498.js | 14 ++++++++++++++ 8 files changed, 94 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..951ed01 --- /dev/null +++ b/bj10818.js @@ -0,0 +1,24 @@ +let input = require("fs") + .readFileSync("/dev/stdin") + .toString() + .trim() + .split(/\s/); +let N = Number(input[0]); +// let stringNumbers = input[1].split(" "); +// let numbers = stringNumbers.map(Number); + +let num = Number(input[1]); +let max = num; +let min = num; + +for (let i = 1; i < N; i++) { + num = Number(input[i + 1]); + if (max < num) { + max = num; + } + if (min > num) { + min = num; + } +} + +console.log(min, max); diff --git a/bj10869.js b/bj10869.js new file mode 100644 index 0000000..e792fa8 --- /dev/null +++ b/bj10869.js @@ -0,0 +1,9 @@ +let input = require("fs").readFileSync("/dev/stdin").toString().split(" "); +let num1 = Number(input[0]); +let 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..8f6cf16 --- /dev/null +++ b/bj2438.js @@ -0,0 +1,13 @@ +let input = require("fs").readFileSync("/dev/stdin").toString().split(" "); +let num = Number(input[0]); + +let answer = ""; + +for (let i = 0; i < num; i++) { + for (let j = 0; j < i + 1; j++) { + answer += "*"; + } + answer += "\n"; +} + +console.log(answer); 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..6ee5536 --- /dev/null +++ b/bj2741.js @@ -0,0 +1,11 @@ +let input = require("fs").readFileSync("/dev/stdin").toString().split(" "); +let num = Number(input[0]); + +let answer = ""; + +// 이렇게 문자열로 한번에 묶어서 출력하면 시간 초과 안뜸 +for (let i = 0; i < num; i++) { + answer += i + 1 + "\n"; +} + +console.log(answer); diff --git a/bj2753.js b/bj2753.js new file mode 100644 index 0000000..bdd2760 --- /dev/null +++ b/bj2753.js @@ -0,0 +1,8 @@ +let input = require("fs").readFileSync("/dev/stdin").toString().split(" "); +let year = Number(input[0]); + +if ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0) { + console.log(1); +} else { + console.log(0); +} diff --git a/bj3052.js b/bj3052.js new file mode 100644 index 0000000..919d31a --- /dev/null +++ b/bj3052.js @@ -0,0 +1,14 @@ +let input1 = require("fs").readFileSync("/dev/stdin").toString().split("\n"); +numbers = input1.map(Number); + +let arr = []; +let num = numbers[0] % 42; + +for (let i = 0; i < 10; i++) { + num = numbers[i] % 42; + if (arr.indexOf(num) === -1) { + arr.push(num); + } +} + +console.log(arr.length); diff --git a/bj9498.js b/bj9498.js new file mode 100644 index 0000000..3e286a2 --- /dev/null +++ b/bj9498.js @@ -0,0 +1,14 @@ +let input = require("fs").readFileSync("/dev/stdin").toString().split(" "); +let score = Number(input[0]); + +if (score >= 90) { + console.log("A"); +} else if (score >= 80) { + console.log("B"); +} else if (score >= 70) { + console.log("C"); +} else if (score >= 70) { + console.log("D"); +} else { + console.log("F"); +}