Codeforces 622B The Time 【水题】
2016-02-13 18:20
459 查看
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
output
input
output
input
output
题意:给你一个时间,问你n分钟后的时间。
AC代码:
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 <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <cstdlib> #include <algorithm> #include <queue> #include <stack> #include <map> #include <set> #include <vector> #include <string> #define INF 1000000 #define eps 1e-8 #define MAXN (10000+10) #define MAXM (2000000+10) #define Ri(a) scanf("%d", &a) #define Rl(a) scanf("%lld", &a) #define Rf(a) scanf("%lf", &a) #define Rs(a) scanf("%s", a) #define Pi(a) printf("%d\n", (a)) #define Pf(a) printf("%.2lf\n", (a)) #define Pl(a) printf("%lld\n", (a)) #define Ps(a) printf("%s\n", (a)) #define W(a) while((a)--) #define CLR(a, b) memset(a, (b), sizeof(a)) #define MOD 1000000007 #define LL long long #define lson o<<1, l, mid #define rson o<<1|1, mid+1, r #define ll o<<1 #define rr o<<1|1 #define PI acos(-1.0) #pragma comment(linker, "/STACK:102400000,102400000") #define fi first #define se second using namespace std; typedef pair<int, int> pii; int main() { int h, m; scanf("%d:%d", &h, &m); int n; Ri(n); m += n; h += m / 60; h %= 24; m %= 60; printf("%02d:%02d\n", h, m); return 0; }
相关文章推荐
- Codeforces 622A Infinite Sequence 【数学】
- leetcode:Clone Graph
- Codeforces 624B Making a String 【水题】
- 141. Linked List Cycle LeetCode
- Codeforces 624A Save Luke 【数学】
- Ubuntu 安装 JAVA 8
- 137. Single Number II LeetCode
- Mysql的大字段问题
- CMD与AMD比较
- usaco 3.4 Electric Fence 2010.8.4
- Java日志框架
- 单片机keil C中的data、bdata、idata、xdata、hdata、pdata、code解释
- 1027. 打印沙漏
- 点击<li>标签触发<a>中的超链接
- 随机数生成之Math.Random()方法
- Python ftp上传文件
- Renascence架构原理——遗传规划算法
- spoj196 2010.8.2
- 回文字符
- 打印函数调用栈