알고리즘/백준

백준 11021: A+B - 7 (Python)

sssbin 2021. 8. 19. 20:49

https://www.acmicpc.net/problem/11021

 

11021번: A+B - 7

각 테스트 케이스마다 "Case #x: "를 출력한 다음, A+B를 출력한다. 테스트 케이스 번호는 1부터 시작한다.

www.acmicpc.net

1. f-string 함수 

' ' 안의 문자는 문자열로 출력, { } 안의 문자는 변수값으로 출력

t=int(input())

for i in range(t):
    a,b=map(int,input().split())
    print(f'Case #{i+1}: {a+b}')

 

2. 문자열 포매팅

t=int(input())

for i in range(t):
    a,b=map(int,input().split())
    print('Case #%d: %d'%(i+1,a+b))

'알고리즘 > 백준' 카테고리의 다른 글

백준 2577: 숫자의 개수 (Python)  (0) 2021.08.24
백준 2562: 최댓값 (Python)  (0) 2021.08.24
백준 10951: A+B - 4 (Python)  (0) 2021.08.19
백준 10871: X보다 작은 수 (Python)  (0) 2021.08.19
백준 15552: 빠른 A+B (Python)  (0) 2021.08.19