Algorithm
- ์ง๊ฐ์ผ๊ฐํ -
๋ฌธ์
๊ณผ๊ฑฐ ์ด์งํธ์ธ๋ค์ ๊ฐ ๋ณ๋ค์ ๊ธธ์ด๊ฐ 3, 4, 5์ธ ์ผ๊ฐํ์ด ์ง๊ฐ ์ผ๊ฐํ์ธ๊ฒ์ ์์๋๋ค.
์ฃผ์ด์ง ์ธ๋ณ์ ๊ธธ์ด๋ก ์ผ๊ฐํ์ด ์ง๊ฐ์ธ์ง ์๋์ง ๊ตฌ๋ถํ์์ค.
์ ์ถ๋ ฅ ์์
๋ฌธ์ ํ๊ธฐ
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let input = [];
rl.on("line", function (line) {
input.push(
line
.toString()
.split(" ")
.map((el) => +el)
);
}).on("close", function () {
input.pop();
input = input.map((el) => el.sort((a, b) => a - b));
for (let i = 0; i < input.length; i++) {
if (input[i][0] ** 2 + input[i][1] ** 2 === input[i][2] ** 2) {
console.log("right");
} else console.log("wrong");
}
process.exit();
});
๋ฐ์ํ
'๊ฐ์ธ๊ณต๋ถ > Algorithm' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค][Node.js] 4458๋ฒ : ์ฒซ ๊ธ์๋ฅผ ๋๋ฌธ์๋ก (0) | 2021.10.25 |
---|---|
[๋ฐฑ์ค][Node.js] 4344๋ฒ : ํ๊ท ์ ๋๊ฒ ์ง (0) | 2021.10.23 |
[๋ฐฑ์ค][Node.js] 3052๋ฒ : ๋๋จธ์ง (0) | 2021.10.20 |
[๋ฐฑ์ค][Node.js] 3046๋ฒ : R2 (0) | 2021.10.19 |
[๋ฐฑ์ค][Node.js] 3003๋ฒ : ๋ค ๋ฒ์งธ ์ (0) | 2021.10.18 |
๋๊ธ