코드
t = int(input())
result = []
for _ in range(t):
total = 0
r, e, c = map(int, input().split())
total = r + c
if e < total:
result.append('do not advertise')
elif e == total:
result.append('does not matter')
elif e > total:
result.append('advertise')
for i in range(len(result)):
print(result[i])
total을 for문 안에 선언해서 한 루프를 돌 때마다 0으로 초기화 시켜서 r과 c의 합을 e와 비교하게끔 만듬
result라는 배열을 선언하고 그 배열에 결과 문자열을 저장하여 마지막에 for문을 통해 1줄에 하나씩 입력 순서에 맞게 결과를 출력하게끔 함
'BeakJoon > Python' 카테고리의 다른 글
[Python] 백준 #10102: 개표 (0) | 2023.12.30 |
---|---|
[Python] 백준 #7567번: 그릇 (0) | 2023.12.30 |
[Python] 백준 #5355번: 화성 수학 (1) | 2023.12.18 |
[Python] 백준 #2530번: 인공지능 시계 (0) | 2023.12.18 |
[Python] 백준 #13458번: 시험 감독 (0) | 2023.12.18 |