codeforces622B

时间:2023-03-09 03:03:24
codeforces622B

The Time

CodeForces - 622B

给你当前的时间(24小时制):HH:MM。输出 x 分钟后的时间是多少?(24小时制)

不明白可以看看例子哦~

Input

第一行给出了当前时间,格式为: HH:MM (0 ≤ HH < 24, 0 ≤ MM < 60). 小时和分钟都给了两位数, 如果其小于10会给出前导0,例如 01:01

第二行会给出一个整数x (0 ≤ x ≤ 104) ——即输出x分钟后的时间

Output

输出一行,以输入的格式,输出x分钟后的时间,如果其小于10,不要忘了加前导0。

不明白可以看看例子哦~

Example

Input
12:00
69
Output
13:09

sol:模拟的时候要细心,考虑全面,很容易挂掉的qaq
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
inline ll read()
{
ll s=;
bool f=;
char ch=' ';
while(!isdigit(ch))
{
f|=(ch=='-'); ch=getchar();
}
while(isdigit(ch))
{
s=(s<<)+(s<<)+(ch^); ch=getchar();
}
return (f)?(-s):(s);
}
#define R(x) x=read()
inline void write(ll x)
{
if(x<)
{
putchar('-'); x=-x;
}
if(x<)
{
putchar(x+''); return;
}
write(x/);
putchar((x%)+'');
return;
}
#define W(x) write(x),putchar(' ')
#define Wl(x) write(x),putchar('\n')
int main()
{
int X,Y,Time;
R(X); R(Y);
Time=read()%(*);
Y=Y+(Time%);
X=(X+Time/)%;
if(Y>=) {X=(X+)%; Y-=;}
if(X<) putchar(''); write(X);
putchar(':');
if(Y<) putchar(''); write(Y);
return ;
}
/*
input
20:20
121
output
22:21 input
02:59
1
output
03:00
*/