[PYTHON] 백준_2884

알람시계

Posted by iheese on September 18, 2021 · 1 min read

내 답

H,M=map(int, input().split())
if H>=0 and M>=45:
    print(H, M-45)
elif H>0 and M<45:
    print(H-1, M+60-45)
elif H==0 and M<45:
    print("23",M+60-45)

참고할 만한 답

H,M=map(int, input().split())
if M>44:
	print(H,m-45):
elif M<45 and H>0:
	print(H-1,M+15)
else:
	print(23,M+15)

나올 수 있는 경우를 잘 나누어서 IF문에 적용