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 https://en.wikipedia.org/wiki/24-hour_clock.

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 <bits/stdc++.h>
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<<x1<<":"<<x2<<"\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;
}

codeforces 622B B. The Time的更多相关文章

  1. Codeforces 622B The Time 【水题】

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

  2. CodeForces 622B The Time

    水题. #include <stdio.h> #include <algorithm> #include <string.h> #include <queue ...

  3. codeforces622B

    The Time CodeForces - 622B 给你当前的时间(24小时制):HH:MM.输出 x 分钟后的时间是多少?(24小时制) 不明白可以看看例子哦- Input 第一行给出了当前时间, ...

  4. python爬虫学习(5) —— 扒一下codeforces题面

    上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...

  5. 【Codeforces 738D】Sea Battle(贪心)

    http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...

  6. 【Codeforces 738C】Road to Cinema

    http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...

  7. 【Codeforces 738A】Interview with Oleg

    http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...

  8. CodeForces - 662A Gambling Nim

    http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...

  9. CodeForces - 274B Zero Tree

    http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...

随机推荐

  1. umbraco v7.6.4 surface controller not found 大深坑!

    注意在修改后台地址过程中对于web.config里的umbracoPath 如果你改成了~/admin,surface controller的路由就变成了 /admin/surface/{contro ...

  2. sql生成器(含凝视)问题修复版

    接上篇http://blog.csdn.net/panliuwen/article/details/47406455 sql生成器--生成含凝视的sql语句 今天我使用自己写的sql生成器了.自我感觉 ...

  3. #region的作用和注释快捷键

    让函数在编辑器中收起来,简洁 #region All MenuItems [@MenuItem("xxx")] public static void Init() { XXXXX; ...

  4. 【php】global的使用与php的全局变量

    php的全局变量和其余编程语言是不同的,在大多数的编程语言中,全局变量在其下的函数.类中自己主动生效.除非被局部变量覆盖,或者根本就不同意再声明同样名称与类型的局部变量.可是php中的全局变量不是默认 ...

  5. java拾遗3----XML解析(三) StAX PULL解析

    使用PULL方式解析XML: Pull是STAX的一个实现 StAX是The Streaming API for XML的缩写,一种利用拉模式解析(pull-parsing)XML文档的API StA ...

  6. VS2017生成类库选择Release失效的问题

    VS的生成可以选择Debug模式或者Release模式,但是我发现在配置里面选择Release无效. 后来发现应该 在 生成->配置管理器  里面设置.

  7. 全栈JavaScript之路( 二十四 )DOM2、DOM3, 不涉及XML命名空间的扩展

    版权声明:本文为博主原创文章.未经博主同意不得转载. https://blog.csdn.net/hatmore/article/details/37658167 (一)DocumentType 类型 ...

  8. 11.23 Eclipse

    一.Eclipse Workspace File-->Switch Workspace 编译环境:Window -- Preferences – Java - Compiler 运行环境:Win ...

  9. wap网站即手机端网页SEO优化注意事项及方法

    定位和页面设计: 无论是PC端还是移动端,网站 都要考虑清楚消费群体的定位问题.虽然智能手机用户数量非常普及,但是要明白中国的大部分手机用户使用的还是2G网络,一直高 喊的3G.4G手机用户只有大约1 ...

  10. MYSQL:基础——触发器

    MYSQL基础——触发器 引入触发器 什么是触发器 如果你想要某条语句(或某些语句)在事件发生时自动执行.比如: 每当订购一个产品时,都从库存数量中减去订购的数量:无论何时删除一行,都在某个存档表中保 ...