728x90
#11021
let input = require('fs').readFileSync('/dev/stdin').toString().split("\n");
const loop = +input[0];
for (i = 1; i <= loop; i++) {
let numbers = input[i].split(" ").map(Number);
console.log(`Case #${i}: ${numbers[0] + numbers[1]}`);
}
๋ฐ์์จ input์ ๋๋ฒ์งธ ์ธ์๋ถํฐ split์ผ๋ก ๋๋๊ธฐ numers[0] numbers[1]
-> Number๋ก ํ์ ๋ณํ ํ ๋ํด์ค ๊ฐ์ ํ๋์ฉ ์ถ๋ ฅ๋๊ฒ ํด์ค๋ค.
#11022
for (i = 1; i <= loop; i++) {
let numbers = input[i].split(" ").map(Number);
console.log(`Case #${i}: ${numbers[0]} + ${numbers[1]} = ${numbers[0] + numbers[1]}`);
}
์์ ๋ฌธ์ ์ ๊ฐ์ ๋งฅ๋ฝ์ด๊ณ , ์ถ๋ ฅํ๋ ์ธ์๋ง ๋๋ ค ์์ผ๋ก ์ถ๋ ฅํด์ฃผ๋ฉด ๋๋ค.
728x90
๋ฐ์ํ
'ํ์ ๊ณต๋ถ > ๐ซง ์๊ณ ๋ฆฌ์ฆ ๊ณต๋ถ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค/Node.js] 2439๋ฒ ํ์ด || JavaScript (0) | 2023.02.27 |
---|---|
[๋ฐฑ์ค/Node.js] 2438๋ฒ ํ์ด || JavaScript (0) | 2023.02.27 |
[๋ฐฑ์ค/Node.js] 15552๋ฒ ํ์ด || JavaScript (0) | 2023.02.26 |
[๋ฐฑ์ค/Node.js] 25314๋ฒ ํ์ด || JavaScript (0) | 2023.02.25 |
[๋ฐฑ์ค/Node.js] 25304๋ฒ ํ์ด || JavaScript (0) | 2023.02.25 |