[알각코] 백준 2884번 - 알람 시계

백준 2884번

0 ≤ H ≤ 23, 0 ≤ M ≤ 59

inputStr = input()
time = [int(x) for x in inputStr.split(' ')]

h = time[0]
m = time[1]

if (time[0] == 0):
	if (time[1] < 45):
		h = 23
		m = 60 - abs(time[1] - 45)

	else:
		m = 45 - time[1]

else:
	if (time[1] < 45):
		h = time[0] - 1
		m = 60 - abs(time[1] - 45)
		
	else:
		m = 45 - time[1]

print(h, m)

Screen Shot 2021-07-22 at 9 24 26 PM

inputStr = input()
time = [int(x) for x in inputStr.split(' ')]

h = time[0]
m = time[1]

if (time[0] == 0):
	if (time[1] < 45):
		h = 23
		m = 60 - abs(time[1] - 45)

	else:
		m = time[1] - 45

else:
	if (time[1] < 45):
		h = time[0] - 1
		m = 60 - abs(time[1] - 45)
		
	else:
		m = time[1] - 45

print(h, m)

Screen Shot 2021-07-22 at 9 44 51 PM