当前位置:网站首页>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}')边栏推荐
- Talking about GIS Data (5) - Geographic Coordinate System
- BIOTIN ALKYNE CAS: 773888-45-2 Price, Supplier
- Detailed explanation of MOSN reverse channel
- typescript40-class类的保护修饰符
- -寻找鞍点-
- junit总结
- User password encryption tool
- Djiango第三次培训
- 在树莓派上搭建属于自己的网页(2)
- 13.
lt.647. Palindromic substring + lt.516. Longest palindrome subsequence
猜你喜欢

Common fluorescent dyes to modify a variety of groups and its excitation and emission wavelength data in the data

typescript40-class类的保护修饰符

【Biotin Azide|cas:908007-17-0】Price_Manufacturer

阿里云对象存储oss私有桶生成链接
网络流媒体下载的 10 种方法(以下载 Echo 音乐为例)

web安全-PHP反序列化漏洞

Build your own web page on raspberry pie (1)

idea使用@Autowired注解爆红原因及解决方法

曲线特征----曲线弯曲程度的探究

typescript49-交叉类型
随机推荐
Benchmark 第一篇 了解Benchmark
深度学习入门之GRU
Apache DolphinScheduler版本2.0.5分布式集群的安装
判断回文数
ss-1.curl (cloud-provider-payment8001)
typescript39-class类的可见修饰符
快速上手 Mockito 单元测试框架
breed Web刷机升级详细教材修正编译器固件说明_itkeji.top
Shell conditional statement judgment
Djiango第四次培训笔记
轨迹(形状)相似性判断与度量方法
High availability, two locations and three centers
Power button 561. An array of split
web安全-PHP反序列化漏洞
UV decomposition of biotin - PEG2 - azide | CAS: 1192802-98-4 biotin connectors
Lambda表达式案例
odps的临时查询能在写sql的时候就给结果一个命名不?
Exception (abnormal) and Error (error) difference analysis
13.< tag-动态规划和回文字串>lt.647. 回文子串 + lt.516.最长回文子序列
高可用 两地三中心