博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
codeforces 622B B. The Time
阅读量:4616 次
发布时间:2019-06-09

本文共 1645 字,大约阅读时间需要 5 分钟。

B. The Time
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

You are given the current time in 24-hour format hh:mm. Find and print the time after a minutes.

Note that you should find only the time after a minutes, see the examples to clarify the problem statement.

You can read more about 24-hour format here .

Input

The first line contains the current time in the format hh:mm (0 ≤ hh < 24, 0 ≤ mm < 60). The hours and the minutes are given with two digits (the hours or the minutes less than 10 are given with the leading zeroes).

The second line contains integer a (0 ≤ a ≤ 104) — the number of the minutes passed.

Output

The only line should contain the time after a minutes in the format described in the input. Note that you should print exactly two digits for the hours and the minutes (add leading zeroes to the numbers if needed).

See the examples to check the input/output format.

Examples
input
23:59 10
output
00:09
input
20:20 121
output
22:21
input
10:10 0
output
10:10

 题意:问从起点时间经过所给的时间,终点时间是多少;

思路:将时间都转换成分钟;

AC代码:

#include 
using namespace std;char str[8];int a;int main(){ scanf("%s",str); scanf("%d",&a); int x1,x2; x1=(str[0]-'0')*10+(str[1]-'0'); x2=(str[3]-'0')*10+(str[4]-'0'); //cout<
<<":"<
<<"\n"; x2+=a; x1+=x2/60; x2%=60; x1%=24; if(x1<10)printf("0%d:",x1); else printf("%d:",x1); if(x2<10)printf("0%d\n",x2); else printf("%d\n",x2); return 0;}

转载于:https://www.cnblogs.com/zhangchengc919/p/5221728.html

你可能感兴趣的文章
云计算技能图谱
查看>>
委托、Lambda表达式和事件
查看>>
typecho模板制作代码收集
查看>>
Python学习笔记4:集合方法
查看>>
elasticsearch的监控脚本
查看>>
你还在为使用P/Invoke时,写不出win32 api对应的C#声明而犯愁吗?
查看>>
msbuild property metadata会overwrite msbuild task中的properties
查看>>
python系列前期笔记
查看>>
Android -- sqlite数据库随apk发布
查看>>
Android -- Fragment
查看>>
前端性能优化和规范
查看>>
python 之进程篇
查看>>
框架编程之路一
查看>>
Verilog学习----运算符、结构说明语句
查看>>
需求分析报告
查看>>
第四次作业
查看>>
Linux下使用pv监控进度
查看>>
Luogu P4901 排队 fib数列+树状数组+倍增
查看>>
PHP 锁机制
查看>>
每天CookBook之Python-036
查看>>