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(" "));
๋ฐ์ํ
'๊ฐ์ธ๊ณต๋ถ > Algorithm' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค][Node.js] 3052๋ฒ : ๋๋จธ์ง (0) | 2021.10.20 |
---|---|
[๋ฐฑ์ค][Node.js] 3046๋ฒ : R2 (0) | 2021.10.19 |
[๋ฐฑ์ค][Node.js] 3003๋ฒ : ํน, ํธ, ๋ฃฉ, ๋น์, ๋์ดํธ, ํฐ (0) | 2021.10.17 |
[๋ฐฑ์ค][Node.js] 2960๋ฒ : ์๋ผํ ์คํ ๋ค์ค์ ์ฒด (0) | 2021.10.14 |
[๋ฐฑ์ค][Node.js] 2953๋ฒ : ๋๋ ์๋ฆฌ์ฌ๋ค (0) | 2021.10.13 |
๋๊ธ