Codeforces 622B The Time 【水题】
2016-02-16 21:47
218 查看
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
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分钟后的时间
#include<stdio.h> #include<string.h> #include<string> #include<math.h> #include<algorithm> #define LL long long #define PI atan(1.0)*4 #define DD doublea #define MAX 1010 #define mod 10007 using namespace std; int n,m; int main() { int j,i,sum,t; int x,y,z; while(scanf("%d:%d",&n,&m)!=EOF) { scanf("%d",&t); x=y=z=0; x=t%60; z=t/60; m=x+m; if(m>=60) { y=m/60; m=m%60; } n=n+z+y; if(n%24==0) n=0; if(n%24!=0) n=n%24; printf("%02d:%02d\n",n,m); } return 0; }
相关文章推荐
- 20160129.CCPP体系详解(0008天)
- 20160129.CCPP体系详解(0008天)
- (java) Search a 2D Matrix
- 2 Types of Linux File Locking (Advisory, Mandatory Lock Examples)
- C语言函数
- 华为机试题:字符转换Univesity
- Java基础05 实施接口
- 解密伪科学-碧波庭
- linux常用命令
- RXJava学习笔记(2)
- 20160127.CCPP体系详解(0006天)
- 20160128.CCPP体系详解(0007天)
- 20160127.CCPP体系详解(0006天)
- 20160128.CCPP体系详解(0007天)
- C语言的流程控制
- [Android Pro] Gradle Tips#1-tasks
- Java基础04 封装与接口
- 20160126.CCPP体系详解(0005天)
- 20160126.CCPP体系详解(0005天)
- 编程题#3:计算数列平方和(C++程序设计第10周)