CodeForces 622B

来源:互联网 发布:智慧环保大数据平台 编辑:程序博客网 时间:2024/06/05 09:15
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 formathh: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 than10 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:5910
Output
00:09
Input
20:20121
Output
22:21
Input
10:100
Output

10:10

题意:给你一个时间,问过了一定分钟后,该时间是多少。

解法:模拟


#include <iostream>
#include<stdio.h>
#include<queue>
#include<string.h>
#include<stack>
#include<map>
using namespace std;
#define ll long long int
int main()
{
    //freopen("in.txt","r",stdin);
    int hh,mm,mint;
    char c;
    scanf("%d%c%d",&hh,&c,&mm);
    scanf("%d",&mint);
    mint=mint%(24*60);
    mm=mm+mint%60;
    if(mm>=60)
    {
        mm=mm%60;
        hh++;
    }
    hh=(hh+mint/60)%24;
    if(hh<10) printf("0");
    printf("%d:",hh);
    if(mm<10)printf("0");
    printf("%d",mm);
    return 0;
}


0 0
原创粉丝点击