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

[๋ฐฑ์ค€][Node.js] 5597๋ฒˆ : ๊ณผ์ œ ์•ˆ ๋‚ด์‹  ๋ถ„..?

by ๐Ÿ‡๋ฐ•๋ด‰๋ด‰๐Ÿ‡ 2021. 11. 27.

 

 

Algorithm

-  ๊ณผ์ œ ์•ˆ ๋‚ด์‹  ๋ถ„..? -

 


 

๋ฌธ์ œ

X๋Œ€ํ•™ M๊ต์ˆ˜๋‹˜์€ ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์ˆ˜์—…์„ ๋งก๊ณ  ์žˆ๋‹ค. ๊ต์‹ค์—” ํ•™์ƒ์ด 30๋ช…์ด ์žˆ๋Š”๋ฐ, ํ•™์ƒ ๋ช…๋ถ€์—” ๊ฐ ํ•™์ƒ๋ณ„๋กœ 1๋ฒˆ๋ถ€ํ„ฐ 30๋ฒˆ๊นŒ์ง€ ์ถœ์„๋ฒˆํ˜ธ๊ฐ€ ๋ถ™์–ด ์žˆ๋‹ค.

 

๊ต์ˆ˜๋‹˜์ด ๋‚ด์ค€ ํŠน๋ณ„๊ณผ์ œ๋ฅผ 28๋ช…์ด ์ œ์ถœํ–ˆ๋Š”๋ฐ, ๊ทธ ์ค‘์—์„œ ์ œ์ถœ ์•ˆ ํ•œ ํ•™์ƒ 2๋ช…์˜ ์ถœ์„๋ฒˆํ˜ธ๋ฅผ ๊ตฌํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค.

 

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

 

๋ฌธ์ œ ํ’€๊ธฐ

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());
}).on("close", function () {
	let arr = [];
	for (let i = 1; i <= 30; i++) {
		if (!input.includes(i)) arr.push(i);
		if (arr.length === 2) break;
	}
	console.log(arr.join("\n"));
	process.exit();
});

 

 

 

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€