BC42 小乐乐定闹钟
思路:
step1:输入起始时刻和分钟数,用空格隔开;
step2:分别求得计算过之后的时和分,注意循环和进位;
step3:格式化输出打印,注意限定条件;
代码如下:
n = input().split(' ')
m = n[1]
q = n[0]
q = q.split(':')
p = int(q[0])
e = int(q[1])
minute = (int(m)%60 + e)%60
hour1 = (int(m)%60 + e)//60
hour = (int(m)//60 + p + hour1)%24
if hour < 10 and minute < 10:
print('0{}:0{}'.format(hour,minute))
elif hour < 10 and minute > 10:
print('0{}:{}'.format(hour,minute))
elif hour >10 and minute < 10:
print('{}:{}0'.format(hour,minute))
elif hour > 10 and minute > 10:
print('{}:{}'.format(hour,minute))