当前位置:网站首页>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}')边栏推荐
猜你喜欢

阿里云对象存储oss私有桶生成链接

typescript42-readonly修饰符

【转】最小描述长度准则MDL(Minimun Description Length)

UV decomposition of biotin - PEG2 - azide | CAS: 1192802-98-4 biotin connectors

Talking about GIS Data (5) - Geographic Coordinate System

Modified BiotinDIAZO-Biotin-PEG3-DBCO|diazo-biotin-tripolyethylene glycol-diphenylcyclooctyne

Build your own web page on the Raspberry Pi (2)

内部类、static关键字、final

Newifi路由器第三方固件玩机教程,这个路由比你想的更强大以及智能_Newifi y1刷机_smzdm

Install IIS services (Internet Information Services (Internet Information Services, abbreviated IIS, Internet Information Services)
随机推荐
UV decomposition of biotin - PEG2 - azide | CAS: 1192802-98-4 biotin connectors
Peptides mediated PEG DSPE of phospholipids, targeted functional materials - PEG - RGD/TAT/NGR/APRPG
嵌入式-I2C-物理电路图
Common fluorescent dyes to modify a variety of groups and its excitation and emission wavelength data in the data
Create a tree structure
-飞机大战-
typescript40-class类的保护修饰符
传说中可“免费白拿”的无线路由器 - 斐讯 K2 最简单刷 breed 与第三方固件教程
网络流媒体下载的 10 种方法(以下载 Echo 音乐为例)
ss-4.2 多个eureka集群案例
0.ROS常用命令
Fluorescent marker peptides FITC/AMC/FAM/Rhodamine TAMRA/Cy3 / Cy5 / Cy7 - Peptide
数据分析 第一篇
ss-5.consul服务端+生产者+消费者
ss-1.curl (cloud-provider-payment8001)
User password verification
2.ROS通信机制
ss-3.工程重构
1069 微博转发抽奖 (20 分)(C语言)
IO流及其操作