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

[๋ฐฑ์ค€][Node.js] 2675๋ฒˆ : ๋ฌธ์ž์—ด ๋ฐ˜๋ณต

by ๐Ÿ‡๋ฐ•๋ด‰๋ด‰๐Ÿ‡ 2021. 9. 6.

 

 

Algorithm

-  ๋ฌธ์ž์—ด ๋ฐ˜๋ณต -

 


 

๋ฌธ์ œ

๋ฌธ์ž์—ด S๋ฅผ ์ž…๋ ฅ๋ฐ›์€ ํ›„์—, ๊ฐ ๋ฌธ์ž๋ฅผ R๋ฒˆ ๋ฐ˜๋ณตํ•ด ์ƒˆ ๋ฌธ์ž์—ด P๋ฅผ ๋งŒ๋“  ํ›„ ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค. ์ฆ‰, ์ฒซ ๋ฒˆ์งธ ๋ฌธ์ž๋ฅผ R๋ฒˆ ๋ฐ˜๋ณตํ•˜๊ณ , ๋‘ ๋ฒˆ์งธ ๋ฌธ์ž๋ฅผ R๋ฒˆ ๋ฐ˜๋ณตํ•˜๋Š” ์‹์œผ๋กœ P๋ฅผ ๋งŒ๋“ค๋ฉด ๋œ๋‹ค. S์—๋Š” QR Code "alphanumeric" ๋ฌธ์ž๋งŒ ๋“ค์–ด์žˆ๋‹ค.

QR Code "alphanumeric" ๋ฌธ์ž๋Š” 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\$%*+-./: ์ด๋‹ค.

 

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

 

๋ฌธ์ œ ํ’€๊ธฐ

let fs = require("fs");
let input = fs.readFileSync("/dev/stdin").toString().trim().split("\n");

for (let i = 1; i < input.length; i++) {
	let arr = input[i].split(" ");
	let value = "";
	for (let j = 0; j < arr[1].length; j++) {
		value += arr[1][j].repeat(Number(arr[0]));
	}
	console.log(value);
}

 

 

 

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€