์•Œ๊ณ ๋ฆฌ์ฆ˜ ๋ฌธ์ œ/BOJ_Python

[BOJ/Step3] 11022 : A+B - 8 (Python)

NaNaRin๐Ÿ™ƒ 2021. 2. 1. 21:20

www.acmicpc.net/problem/11022

 

11022๋ฒˆ: A+B - 8

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

www.acmicpc.net


๋ฌธ์ œ

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

 

์ž…๋ ฅ

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

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

 

์ถœ๋ ฅ

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

 

์˜ˆ์ œ ์ž…๋ ฅ 1

5

1 1

2 3

3 4

9 8

5 2

 

์˜ˆ์ œ ์ถœ๋ ฅ 1

Case #1: 1 + 1 = 2

Case #2: 2 + 3 = 5

Case #3: 3 + 4 = 7

Case #4: 9 + 8 = 17

Case #5: 5 + 2 = 7


ํ’€์ด

 

# 11022.py

n = int(input())

for i in range(1, n + 1):
    n, m = map(int, input().split())
    print("Case #" + str(i) + ":", str(n), "+", str(m), "=", str(n + m))