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

[๋ฐฑ์ค€][Node.js] 7572๋ฒˆ : ๊ฐ„์ง€(ๅนฒๆ”ฏ)

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

 

 

Algorithm

-  ๋‘ ๊ฐœ ๋ฝ‘์•„์„œ ๋”ํ•˜๊ธฐ -

 


 

๋ฌธ์ œ

์˜ˆ๋กœ๋ถ€ํ„ฐ ๋™์•„์‹œ์•„์—์„œ๋Š” ์‹ญ๊ฐ„(ๅๅนฒ)๊ณผ ์‹ญ์ด์ง€(ๅไบŒๆ”ฏ)๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์—ฐ๋„๋ฅผ ํ‘œ์‹œํ•˜์˜€๋‹ค. ์‹ญ๊ฐ„์€ "๊ฐ‘์„๋ณ‘์ •๋ฌด๊ธฐ๊ฒฝ์‹ ์ž„๊ณ„"๋ฅผ ๋งํ•˜๋ฉฐ ์‹ญ์ด์ง€๋Š” "์ž์ถ•์ธ๋ฌ˜์ง„์‚ฌ์˜ค๋ฏธ์‹ ์œ ์ˆ ํ•ด"๋ฅผ ๋งํ•œ๋‹ค. ์‹ญ๊ฐ„๊ณผ ์‹ญ์ด์ง€๋กœ ๊ตฌ์„ฑ๋œ ๊ฐ„์ง€๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ 60๋…„์„ ์ฃผ๊ธฐ๋กœ ๊ฐ ์—ฐ๋„์— ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ด๋ฆ„์„ ๋ถ€์—ฌํ•œ๋‹ค: ์ตœ์ดˆ 1๋…„์งธ๋Š” "๊ฐ‘์ž"์ด๊ณ , 2๋…„์งธ๋Š” "์„์ถ•", 3๋…„์งธ๋Š” "๋ณ‘์ธ" ๊ณผ ๊ฐ™์ด ์˜ฌํ•ด์˜ ๊ฐ„์ง€์—์„œ ์‹ญ๊ฐ„๊ณผ ์‹ญ์ด์ง€์˜ ๋‹ค์Œ ๋ฌธ์ž๋ฅผ ์ด๋“ฌํ•ด์˜ ๊ฐ„์ง€๋กœ ์‚ฌ์šฉํ•œ๋‹ค. ์‹ญ๊ฐ„์€ 10๋…„์„ ์ฃผ๊ธฐ๋กœ, ์‹ญ์ด์ง€๋Š” 12๋…„์„ ์ฃผ๊ธฐ๋กœ ์ˆœํ™˜๋œ๋‹ค. ์ด๋Ÿฐ ์ˆœ์„œ๋กœ ํ•˜์—ฌ ๋งˆ์ง€๋ง‰ "๊ณ„ํ•ด"๋Š” 60๋…„์งธ๋ฅผ ๋‚˜ํƒ€๋‚ด๊ณ , 61๋…„์งธ๋Š” ๋‹ค์‹œ "๊ฐ‘์ž"๊ฐ€ ๋œ๋‹ค.

 

60๊ฐ‘์ž๋ฅผ ์„œ์–‘์‹์œผ๋กœ ๋‚˜ํƒ€๋‚ด๊ธฐ ์œ„ํ•ด 

  1. ์‹ญ๊ฐ„์„ 0๋ถ€ํ„ฐ 9๊นŒ์ง€์˜ ์ •์ˆ˜๋กœ ํ‘œํ˜„ํ•˜๊ณ  
  2. ์‹ญ์ด์ง€๋ฅผ "ABCDEFGHIJKL"๋กœ ํ‘œํ˜„ํ•˜๊ณ 
  3. ์‹ญ๊ฐ„๊ณผ ์‹ญ์ด์ง€์˜ ์ˆœ์„œ๋ฅผ ๋ฐ”๊พผ๋‹ค๊ณ  ํ•˜์ž.

์ด๋ฅผ ์„œ์–‘์‹ ๊ฐ„์ง€ ํ‘œํ˜„๋ฒ•์ด๋ผ๊ณ  ๋ถ€๋ฅด์ž. ์˜ˆ๋ฅผ ๋“ค๋ฉด, "๊ฐ‘์ž"๋Š” "A0"๋กœ "์„์ถ•"์€ "B1", "๊ณ„ํ•ด"๋Š” "L9"์œผ๋กœ ํ‘œํ˜„๋œ๋‹ค. 2013๋…„์€ ๊ณ„์‚ฌ๋…„์ด๋ฏ€๋กœ "F9"์œผ๋กœ ํ‘œํ˜„๋˜๊ณ , 2014๋…„์€ ๊ฐ‘์˜ค๋…„์œผ๋กœ "G0" ๋กœ ํ‘œํ˜„๋œ๋‹ค.

 

์ž…๋ ฅ์œผ๋กœ ์ฃผ์–ด์ง„ ์—ฐ๋„๋ฅผ ์„œ์–‘์‹ ๊ฐ„์ง€ ํ‘œํ˜„๋ฒ•์œผ๋กœ ๋‚˜ํƒ€๋‚ธ ๊ฒƒ์„ ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค.

 

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

 

๋ฌธ์ œ ํ’€๊ธฐ

const readline = require("readline");
const rl = readline.createInterface({
	input: process.stdin,
	output: process.stdout,
});
let input = 0;
rl.on("line", function (line) {
	input = +line.toString();
}).on("close", function () {
	input -= 4;
	let gan = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
	let zi = "ABCDEFGHIJKL".split("");
	let num10 = input < 0 ? gan.length + input : input % 10;
	let num12 = input < 0 ? zi.length + input : input % 12;
	console.log(zi[num12] + gan[num10]);
	process.exit();
});

 

 

 

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€