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

[๋ฐฑ์ค€][Node.js] 3003๋ฒˆ : ๋„ค ๋ฒˆ์งธ ์ 

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

 

 

Algorithm

-  ๋„ค ๋ฒˆ์งธ ์  -

 


 

๋ฌธ์ œ

์„ธ ์ ์ด ์ฃผ์–ด์กŒ์„ ๋•Œ, ์ถ•์— ํ‰ํ–‰ํ•œ ์ง์‚ฌ๊ฐํ˜•์„ ๋งŒ๋“ค๊ธฐ ์œ„ํ•ด์„œ ํ•„์š”ํ•œ ๋„ค ๋ฒˆ์งธ ์ ์„ ์ฐพ๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค.

 

์ž…์ถœ๋ ฅ ์˜ˆ์‹œ

 

๋ฌธ์ œ ํ’€๊ธฐ

let fs = require("fs");
let input = fs.readFileSync("/dev/stdin")
	.toString()
	.trim()
	.split("\n")
	.map((el) => el.split(" ").map((el) => Number(el)));

let x = input.map((el) => el[0]);
let y = input.map((el) => el[1]);
let result = [];

for (let i = 0; i < x.length; i++) {
	if (x.filter((el) => el === x[i]).length % 2 === 1) result[0] = x[i];
	if (y.filter((el) => el === y[i]).length % 2 === 1) result[1] = y[i];
}

console.log(result.join(" "));

 

 

 

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€