Educational Codeforces Round 7 B. The Time

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.

Sample test(s)
Input
23:59
10
Output
00:09
Input
20:20
121
Output
22:21
Input
10:10
0
Output
10:10

题意:;给你一个时间,问过了n分钟后是什么时间

思路:直接写,水




ac代码:
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stack>
#include<set>
#include<queue>
#include<vector>
#include<iostream>
#include<algorithm>
#define MAXN 1010000
#define LL long long
#define ll __int64
#define INF 0xfffffff
#define mem(x) memset(x,0,sizeof(x))
#define PI acos(-1)
using namespace std;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
LL powmod(LL a,LL b,LL MOD){LL ans=1;while(b){if(b%2)ans=ans*a%MOD;a=a*a%MOD;b/=2;}return ans;}
//head
int main()
{
	int hh,mm,len;
	while(scanf("%d:%d",&hh,&mm)!=EOF)
	{
		scanf("%d",&len);
		int a=len/60;
		int b=len%60;
		//printf("a=%d b=%d\n",a,b);
		int ansb=(b+mm)%60;
		int k=(b+mm)/60;
		int ansa=(hh+k+a)%24;
		printf("%02d:%02d\n",ansa,ansb);
	}
	return 0;
}


 

你可能感兴趣的:(Educational Codeforces Round 7 B. The Time)