1074: 人见人爱A+B
来源:互联网 发布:java和scala 编辑:程序博客网 时间:2024/06/06 09:39
题目
Description
AOJ面已经有10来道A+B的题目了,相信这些题目曾经是大家的最爱,希望今天的这个A+B能给大家带来好运,也希望这个题目能唤起大家对ACM曾经的热爱。 这个题目的A和B不是简单的整数,而是两个时间,A和B 都是由3个整数组成,分别表示时分秒,比如,假设A为34 45 56,就表示A所表示的时间是34小时 45分钟 56秒。
Input
输入数据有多行组成,首先是一个整数N,表示测试实例的个数,然后是N行数据,每行有6个整数AH,AM,AS,BH,BM,BS,分别表示时间A和B所对应的时分秒。题目保证所有的数据合法。
Output
对于每个测试实例,输出A+B,每个输出结果也是由时分秒3部分组成,同时也要满足时间的规则(即:分和秒的取值范围在0~59),每个输出占一行,并且所有的部分都可以用32位整数表示。
Sample Input
1
1 2 3 4 5 6
Sample Output
5 7 9
代码块
import java.util.Scanner;public class Main{ public static void main(String[] args) { Scanner cn = new Scanner(System.in); int n = cn.nextInt(); while (n-- > 0) { int a = cn.nextInt(); int b = cn.nextInt(); int c = cn.nextInt(); int d = cn.nextInt(); int e = cn.nextInt(); int f = cn.nextInt(); int x = a + d; int y = b + e; int z = c + f; if (z >= 60) { z = z % 60; y++; if (y >= 60) { y = y % 60; x++; } } else { if (y >= 60) { y = y % 60; x++; } } System.out.println(x + " " + y + " " + z); } cn.close(); }}
0 0
- 1074 -- 人见人爱A^B
- 1074: 人见人爱A+B
- 1074:人见人爱A+B
- akoj-1074-人见人爱A^B
- A - 人见人爱A^B
- HDOJ2035 人见人爱A^B
- 人见人爱A^B
- 2033 人见人爱A+B
- 2034 人见人爱A-B
- 2035 人见人爱A^B
- hdu_2033_人见人爱A+B
- hdu_2034_人见人爱A-B
- hdu_2035_人见人爱A^B
- 2035: 人见人爱A^B
- 人见人爱A-B
- [ACM]人见人爱A^B
- hdoj_2033 人见人爱A+B
- hdoj_2034 人见人爱A-B
- 当数据量较大时,两个tab切换的效率问题
- python-22-构建xml文档
- C语言条件编译详解
- HDU 3974-Assign the task(dfs构建结构+裸线段树)
- 收集service源码分析文章
- 1074: 人见人爱A+B
- 字符编码笔记:ASCII,Unicode和UTF-8
- python-23-读写excel文件
- SharePreference 跨进程使用测试
- bzoj1084: [SCOI2005]最大子矩阵
- SSAS:OLE DB 错误: OLE DB 或 ODBC 错误 : Login failed for user 'NT Service\MSSQLServerOLAPService'
- c++数据结构 共享栈的实现
- centos yum -y mysql-server找不到源
- win10系统崩溃经验汇总