Educational Codeforces Round 7 B

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Educational Codeforces Round 7 B相关的知识,希望对你有一定的参考价值。

Description

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.

Sample test(s)
input
23:59
10
output
00:09
input
20:20
121
output
22:21
input
10:10
0
output
10:10
一个简单的模拟
 1 #include<stdio.h>
 2 //#include<bits/stdc++.h>
 3 #include<string.h>
 4 #include<iostream>
 5 #include<math.h>
 6 #include<sstream>
 7 #include<set>
 8 #include<queue>
 9 #include<map>
10 #include<vector>
11 #include<algorithm>
12 #include<limits.h>
13 #define inf 0x3fffffff
14 #define INF 0x3f3f3f3f
15 #define lson l,m,rt<<1
16 #define rson m+1,r,rt<<1|1
17 #define LL long long
18 #define ULL unsigned long long
19 using namespace std;
20 int t;
21 int n,m;
22 int sum,ans,flag;
23 int a,b,c,d;
24 int main()
25 {
26     scanf("%d:%d",&a,&b);
27     scanf("%d",&n);
28     while(n--)
29     {
30         b++;
31         if(b==60)
32         {
33             a++;
34             b=0;
35             if(a==24)
36             {
37                 a=0;
38             }
39         }
40     }
41     printf("%02d:%02d",a,b);
42     return 0;
43 }

 

 

以上是关于Educational Codeforces Round 7 B的主要内容,如果未能解决你的问题,请参考以下文章

Educational Codeforces Round 7 A

Educational Codeforces Round 7

Educational Codeforces Round 90

Educational Codeforces Round 33

Codeforces Educational Codeforces Round 54 题解

Educational Codeforces Round 27