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

[๋ฐฑ์ค€][Node.js] 5063๋ฒˆ : TGN

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

 

 

Algorithm

-  TGN -

 


 

๋ฌธ์ œ

์ƒ๊ทผ์ด๋Š” TGN์‚ฌ์˜ ์‚ฌ์žฅ์ด๋‹ค. TGN์€ Teenager Game Network์˜ ์•ฝ์ž ๊ฐ™์ง€๋งŒ, ์‚ฌ์‹ค Temporary Group Name์˜ ์•ฝ์ž์ด๋‹ค.

์ด ํšŒ์‚ฌ๋Š” ์ฒญ์†Œ๋…„์„ ์œ„ํ•œ ์•ฑ์„ ๋งŒ๋“œ๋Š” ํšŒ์‚ฌ์ด๋‹ค. ์ผ๋…„์— ๊ฑธ์นœ ๊ฐœ๋ฐœ๊ธฐ๊ฐ„ ๋์— ๋“œ๋””์–ด ์•ฑ์„ ์™„์„ฑํ–ˆ๊ณ , ์ด์ œ ํŒ”๊ธฐ๋งŒ ํ•˜๋ฉด ๋œ๋‹ค.

์ƒ๊ทผ์ด๋Š” ๋ฐ์ดํŠธ๋ฅผ ์ธ๊ฐ„์˜ ๋‘๋‡Œ๋กœ ์ดํ•ดํ•  ์ˆ˜ ์—†์„ ์ •๋„๋กœ ๋งŽ์ด ํ•œ๋‹ค. ๋”ฐ๋ผ์„œ ์—„์ฒญ๋‚œ ๋ฐ์ดํŠธ ๋น„์šฉ์ด ํ•„์š”ํ•˜๋‹ค. ์ƒ๊ทผ์ด๋Š” ๊ด‘๊ณ ๋ฅผ ์ ์ ˆํžˆ ํ•ด์„œ ์ˆ˜์ต์„ ์ตœ๋Œ€ํ•œ ์˜ฌ๋ฆฌ๋ ค๊ณ  ํ•œ๋‹ค.

์–ด๋Š๋‚  ํ•˜๋Š˜์„ ๋ฐ”๋ผ๋ณด๋˜ ์ƒ๊ทผ์ด๋Š” ์‹œ๋ฆฌ์šฐ์Šค์˜ ๊ธฐ์šด์„ ๋ฐ›๊ฒŒ ๋˜์—ˆ๊ณ , ๊ด‘๊ณ  ํšจ๊ณผ๋ฅผ ์˜ˆ์ธกํ•˜๋Š” ๋Šฅ๋ ฅ์„ ๊ฐ–๊ฒŒ ๋˜์—ˆ๋‹ค.

๊ด‘๊ณ  ํšจ๊ณผ๊ฐ€ ์ฃผ์–ด์กŒ์„ ๋•Œ, ๊ด‘๊ณ ๋ฅผ ํ•ด์•ผํ• ์ง€ ๋ง์•„์•ผํ• ์ง€ ๊ฒฐ์ •ํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค.

 

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

๊ฐ ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค์— ๋Œ€ํ•ด์„œ, ๊ด‘๊ณ ๋ฅผ ํ•ด์•ผ ํ•˜๋ฉด "advertise", ํ•˜์ง€ ์•Š์•„์•ผ ํ•˜๋ฉด "do not advertise", ๊ด‘๊ณ ๋ฅผ ํ•ด๋„ ์ˆ˜์ต์ด ์ฐจ์ด๊ฐ€ ์—†๋‹ค๋ฉด "does not matter"๋ฅผ ์ถœ๋ ฅํ•œ๋‹ค.

 

๋ฌธ์ œ ํ’€๊ธฐ

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 () {
	input.shift();
    input = input.map((el) => el.split(" ").map((el) => Number(el)));
    let result = [];

for (let i = 0; i < input.length; i++) {
	let noAd = input[i][0];
	let ad = input[i][1] - input[i][2];
	if (noAd > ad) result.push("do not advertise");
	else if (noAd < ad) result.push("advertise");
	else result.push("does not matter");
}

console.log(result.join("\n"));
	process.exit();
});

 

 

 

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€