# [Algorithm/JS] ๋ฐฑ์ค€ 11021๋ฒˆ A+B - 7

๐Ÿ”— ๋ฌธ์ œ ๋ฐ”๋กœ๊ฐ€๊ธฐ (opens new window)

# Question

๋‘ ์ •์ˆ˜ A์™€ B๋ฅผ ์ž…๋ ฅ๋ฐ›์€ ๋‹ค์Œ, A+B๋ฅผ ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค.

# Input

์ฒซ์งธ ์ค„์— ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค์˜ ๊ฐœ์ˆ˜ T๊ฐ€ ์ฃผ์–ด์ง„๋‹ค.

๊ฐ ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค๋Š” ํ•œ ์ค„๋กœ ์ด๋ฃจ์–ด์ ธ ์žˆ์œผ๋ฉฐ, ๊ฐ ์ค„์— A์™€ B๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. (0 < A, B < 10)

# Output

๊ฐ ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค๋งˆ๋‹ค "Case #x: "๋ฅผ ์ถœ๋ ฅํ•œ ๋‹ค์Œ, A+B๋ฅผ ์ถœ๋ ฅํ•œ๋‹ค. ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค ๋ฒˆํ˜ธ๋Š” 1๋ถ€ํ„ฐ ์‹œ์ž‘ํ•œ๋‹ค.

# Example

# Input

5
1 1
2 3
3 4
9 8
5 2
1
2
3
4
5
6

# Output

Case #1: 2
Case #2: 5
Case #3: 7
Case #4: 17
Case #5: 7
1
2
3
4
5

# Solution

const [t, ...rest] = require('fs')
  .readFileSync('./input/11021.txt')
  .toString()
  .split('\n');
let result = '';
for (let i = 0; i < Number(t); i++) {
  const [a, b] = rest[i].split(' ').map(Number);
  result += `Case #${i + 1}: ${a + b} \n`;
}
console.log(result);
1
2
3
4
5
6
7
8
9
10
Last Updated: 2022. 6. 5. ์˜คํ›„ 3:42:39