1093: People see love a+b time limit:1 Sec Memory limit:128 MB
submit:474 solved:174
[Submit] [Status] [BBS] Description
The ACM above already have 10来 road a+b of the topic, believe these topics were everyone's favorite, Hope today's a+b can bring good luck to everyone, also hope this topic can arouse everyone to ACM once love.
The subject of A and B is not a simple integer, but two times, A and b are composed of 3 integers, respectively, for example, if a is 34 45 56, the time represented by a is 34 hours 45 minutes 56 seconds.
Input
The input data is composed of multiple lines, first an integer n, the number of test instances, and then n rows of data, each line has 6 integer ah,am,as,bh,bm,bs, respectively, representing the time of day A and b corresponding to the second cent. The title ensures that all data is valid.
Output
For each test instance, the output is a+b, and each output is also made up of a time division of 3 parts, but also to meet the rules of timing (i.e., the value range of minutes and seconds in 0~59), each output is a row, and all the parts can be expressed in 32-bit integers.
Sample Input11 2 3 4 5 6Sample Output5 7 9HINT Source
Software Academy
#include <stdio.h>#include<string.h>intMain () {intN; scanf ("%d",&N); while(n--) { inta[6],b[4]; Memset (A,0,sizeof(a)); memset (b,0,sizeof(b)); scanf ("%d%d%d%d%d%d", &a[0],&a[1],&a[2],&a[3],&a[4],&a[5]); b[0]=a[0]+a[3]; b[1]=a[1]+a[4]; b[2]=a[2]+a[5]; while(b[2]> -) {b[1]++; b[2]=b[2]- -; } while(b[1]> -) {b[0]++; b[1]=b[1]- -; } printf ("%d%d%d\n", b[0],b[1],b[2]); }}
People See people love a+b