当前位置:网站首页>lintcode2330 · 计算x秒后的时间
lintcode2330 · 计算x秒后的时间
2022-08-03 05:11:00 【北北的巷栀酒】
描述
你的代码需要从标准输入流(控制台)中读入当前时间,输入形式如 hh:mm:ss
,分别代表时、分和秒,再给出一个正整数 x
,求经过 x
秒后的时间表示,计算出结果后并打印到标准输出流(控制台)中。
样例一
当 hh:mm:ss = 07:59:40
,x = 20
时,程序执行打印出的结果为:
08:00:00
样例二
当 hh:mm:ss = 23:00:01
,x = 86459
时,程序执行打印出的结果为:
23:01:00
代码编辑:
# write your code here
# read data from console
# output the answer to the console according to the requirements of the question
s=input()
l=int(input())
hh=int(s[0:2])
mm=int(s[3:5])
ss=int(s[6:8])
a=ss+l
ss=a%60
b=int(mm+a/60)
mm=b%60
hh=int((hh+b/60)%24)
hh=str(hh).rjust(2,'0')
mm=str(mm).rjust(2,'0')
ss=str(ss).rjust(2,'0')
print(f'{hh}:{mm}:{ss}')
边栏推荐
猜你喜欢
随机推荐
2. 两数相加
MCM box model modeling method and source analysis of atmospheric O3
dataframe插入一列
在树莓派上搭建属于自己的网页(1)
Peptides mediated PEG DSPE of phospholipids, targeted functional materials - PEG - RGD/TAT/NGR/APRPG
Build your own web page on raspberry pie (1)
HarmonyOS应用开发第一次培训
内部类、static关键字、final
Junit
高可用 两地三中心
生活原则。
高效率科研神器——小软件、大能量
网络流媒体下载的 10 种方法(以下载 Echo 音乐为例)
详解Nurbs曲线
Build your own web page on the Raspberry Pi (2)
斐讯K2路由编译Padavan华硕固件和心得
BIOTIN ALKYNE CAS: 773888-45-2 Price, Supplier
Flask Web 报错:
对角矩阵(diagonal matrix)
celery工作原理图