본문 바로가기
알고리즘/문제풀이

sw Expert Academy 시각 덧셈

by 새싹감자 2022. 7. 29.
num=int(input())
for z in range(num):
    hour1, minute1, hour2, minute2 = map(int,input().split())
    print('#{}'.format(z+1),end='')
    if(hour1+hour2>12):
        hourresult=hour1+hour2-12
    else:
        hourresult=hour1+hour2

    if(minute1+minute2>60):
        minuteresult=minute1+minute2-60
        hourresult=hourresult+1
    else:
        minuteresult=minute1+minute2

    print(' {} {}'.format(hourresult,minuteresult))

댓글