HDoj 2033 cute A + B

Problem Description
HDOJ above has 10 channels A + B of the subject, I believe that these problems used to be everyone's favorite, the hope that today's A + B we can bring good luck, and hope that this subject rouses once told the ACM love.
A and B of the subject is not a simple integer, but two time, A and B are composed of three integers, respectively, minutes and seconds, for example, is assumed A 344 556, it means that the time represented by A 34 hours 45 minutes 56 seconds.
 

 

Input
Multiple rows of input data, a first integer N, the number of test cases, and then the data of N rows, each row having six integers AH, AM, AS, BH, BM, BS, A and B denote time when the corresponding Minutes. Topic ensure that all data is valid.
 

 

Output
For each test case, the output of A + B, the result is output for each section 3 minutes and seconds from the composition, but also time rule is satisfied (ie: second points and in the range of 0 to 59), each output representing line, and all the parts can be represented by 32-bit integer.
 

 

Sample Input
2 1 2 3 4 5 6 34 45 56 12 23 34
 

 

Sample Output
5 7 9 47 9 30
 

 

Author
lcy
 

 

Source
 

 

Recommend
lcy   |   We have carefully selected several similar problems for you:   2034  2035  2096  2039  2037 
 
 
 
C language code as follows:
#include<stdio.h>
int main()
{
    int h1,m1,s1;
    int h2,m2,s2;
    int n=0;scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d%d%d%d%d%d",&h1,&m1,&s1,&h2,&m2,&s2);
        h1=h1+h2+(m1+m2)/60;
        m1=(m1+m2+(s1+s2)/60)%60;
        s1=(s1+s2)%60;
        printf("%d %d %d\n",h1,m1,s1);
    }
}

 

Guess you like

Origin www.cnblogs.com/wzmm/p/12593737.html