SWEA
[SWEA] 12368. 24시간 (Python/D3)
dev스카이
2024. 10. 20. 14:50
[문제 링크] 👇
SW Expert Academy
SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!
swexpertacademy.com
풀이
A 시간과 B 시간을 더한다.
더한 시간이 24시간이 넘어가면 24에서 빼준다. (A와 B의 최대는 23이므로 더해서 빼봤자 24이기 때문에 단순히 24만 뺀다.)
Solution
test_case = int(input())
for tc in range(1, test_case + 1):
a, b = map(int, input().split())
result = 0
result = a + b
if result >= 24: #24시간 이상이면
result -= 24
print("#%d %d" %(tc, result))