HDOJ 2033 人见人爱A+B

简介: HDOJ 2033 人见人爱A+B

Problem Description

HDOJ上面已经有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

2

1 2 3 4 5 6

34 45 56 12 23 34


Sample Output

5 7 9

47 9 30

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        while(n-->0){
            int aH = sc.nextInt();
            int aM = sc.nextInt();
            int aS = sc.nextInt();
            int bH = sc.nextInt();
            int bM = sc.nextInt();
            int bS = sc.nextInt();
            int cH,cM,cS;
            int m;
            cS = (aS+bS)%60;
            m=(aS+bS)/60;
            cM = (aM+bM+m)%60;
            m=(aM+bM+m)/60;
            cH = aH+bH+m;
            System.out.println(cH+" "+cM+" "+cS);
        }
    }
}
目录
相关文章
|
7月前
|
Java C++
hdoj 1715 大菲波数
先java代码
31 1
|
7月前
hdoj 4572 Bottles Arrangement
虽然不知道怎么做,但是AC还是没有问题的。 大概就是循环n次,从m加到m-n/2 除了最后一个数,每个都加两次。
21 0
|
7月前
hdoj 1907
这是一道博弈的题,准确说是尼姆博弈,只要判断各项的异或值即可。
19 0
HDOJ 2040 亲和数
HDOJ 2040 亲和数
90 0
HDOJ 2004 成绩转换
HDOJ 2004 成绩转换
68 0
HDOJ 2013 蟠桃记
HDOJ 2013 蟠桃记
79 0
|
人工智能 算法
HDOJ 3466 Proud Merchants
Problem Description Recently, iSea went to an ancient country. For such a long time, it was the most wealthy and powerful kingdom in the world.
905 0
|
Java BI 数据安全/隐私保护
HDOJ 2100 Lovekey
Problem Description XYZ-26进制数是一个每位都是大写字母的数字。 A、B、C、…、X、Y、Z 分别依次代表一个0 ~ 25 的数字,一个 n 位的26进制数转化成是10进制的规则如下 A0A1A2A3…An-1 的每一位代表的数字为a0a1a2a3…...
723 0