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 }
复制代码

 

 

posted @   樱花落舞  阅读(212)  评论(0编辑  收藏  举报
编辑推荐:
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
· 三行代码完成国际化适配,妙~啊~
点击右上角即可分享
微信分享提示