๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๊ฐœ์ธ๊ณต๋ถ€/Algorithm

[๋ฐฑ์ค€][Node.js] 4153๋ฒˆ : ์ง๊ฐ์‚ผ๊ฐํ˜•

by ๐Ÿ‡๋ฐ•๋ด‰๋ด‰๐Ÿ‡ 2021. 10. 21.

 

 

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();
});

 

 

 

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€