当前位置:网站首页>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}')边栏推荐
- MySql数据库
- VSO Downloader Ultimate 5.0.1.45 中文多语免费版 在线视频下载工具
- 1095 解码PAT准考证 (25 分)(C语言)
- Build your own web page on raspberry pie (1)
- tag单调栈-单调栈预备知识-lt.739. 每日温度
- 3. 无重复字符的最长子串
- 在树莓派上搭建属于自己的网页(2)
- Odps temporary query can write SQL, turned out to a named?
- Install PostgreSQL on Windows
- Length n of condensed distance matrix ‘y‘ must be a binomial coefficient
猜你喜欢

web安全-SSTI模板注入漏洞

Tag stack - stack monotonically preparatory knowledge - lt. 739. The daily temperature

Redis常用命令

力扣561. 数组拆分

shell script loop statement

Kaggle(四)Scikit-learn
![[Harmony OS] [ArkUI] ets development graphics and animation drawing](/img/36/f4c91f794b1321f11a24505d1617fb.png)
[Harmony OS] [ArkUI] ets development graphics and animation drawing

Power button 561. An array of split

ModelArts第二次培训

typescript40-class类的保护修饰符
随机推荐
Secondary development of WinForm controls
UV decomposition of biotin - PEG2 - azide | CAS: 1192802-98-4 biotin connectors
-查找数-
-最低分-
User password encryption tool
Presto installation and deployment tutorial
业务表解析-余额系统
HarmonyOS应用开发培训第二次作业
Lambda表达式案例
ModelArts第二次培训
网络流媒体下载的 10 种方法(以下载 Echo 音乐为例)
presto安装部署教程
1. 两数之和
高效率科研神器——小软件、大能量
typescript42-readonly修饰符
Business table analysis - balance system
轨迹(形状)相似性判断与度量方法
【 Harmony OS 】 【 ano UI 】 lightweight data storage
1089 狼人杀-简单版 (20 分)
【Biotin Azide|cas:908007-17-0】Price_Manufacturer