We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5d9eb8a commit d90a2aaCopy full SHA for d90a2aa
서정우/10주차/260306.js
@@ -0,0 +1,24 @@
1
+const fs = require("fs");
2
+const filePath =
3
+ process.platform === "linux" ? "/dev/stdin" : "./서정우/input.txt";
4
+const input = fs
5
+ .readFileSync(filePath)
6
+ .toString()
7
+ .trim()
8
+ .split("\n")
9
+ .map((el) => el.trim());
10
+
11
+const lines = input.slice(1).map((line) => line.split("-"));
12
13
+lines.forEach((line) => {
14
+ const [a, b] = line;
15
+ const aValue = a
16
+ .split("")
17
+ .reduce(
18
+ (sum, char, idx, arr) =>
19
+ sum + Math.pow(26, arr.length - idx - 1) * (char.charCodeAt(0) - 65),
20
+ 0,
21
+ );
22
+ const bValue = Number(b);
23
+ console.log(Math.abs(aValue - bValue) <= 100 ? "nice" : "not nice");
24
+});
서정우/input.txt
@@ -1,2 +1,3 @@
-선데이코딩
-딩코이데선
+2
+ABC-0123
+AAA-9999
0 commit comments