๐ฅ Algorithm/Baekjoon
[๋ฐฑ์ค 3009๋ฒ] ๋ค ๋ฒ์งธ ์ - ์๋ฐ์คํฌ๋ฆฝํธ(nodejs)
Lennon
2022. 1. 25. 22:54
728x90
๋ฐ์ํ
https://www.acmicpc.net/problem/3009
const fs = require('fs');
const input = fs
.readFileSync('dev/stdin')
.toString()
.trim()
.split('\n')
.map((v) => v.split(' '));
let x = input.map((v) => v[0]).sort((a, b) => a - b);
let y = input.map((v) => v[1]).sort((a, b) => a - b);
x = x[0] === x[1] ? x[2] : x[0];
y = y[0] === y[1] ? y[2] : y[0];
console.log(x, y);
๊ฐ ์ขํ๋ฅผ ์ ๋ ฌํ ํ
๊ฐ ์ขํ์ ์ฒซ ๋ฒ์งธ์ ๋ ๋ฒ์งธ๊ฐ ๊ฐ์ผ๋ฉด ์ธ ๋ฒ์งธ๋ก ์ ํด์ค๋ค.
728x90
๋ฐ์ํ