HDU 2033 people see people love A+b (Java)

Source: Internet
Author: User

Problem:

I is always used when I is used in the For loop, so that when I change to something else, please pay more attention to the consistency of the elements of the loop for each for loop.

In the case of M,y has the value of habitual will it when 0 direct assignment, please note!!


People See people love a+bTime limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 30111 Accepted Submission (s): 20076


Problem descriptionhdoj above already have 10来 Road a+b topic, I believe these topics were everyone's favorite, I hope today this a+b can bring good luck to everyone, also hope that 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 data is composed of multiple lines, first an integer n, representing the number of test instances, then n rows of data, each line has 6 integer ah,am,as,bh,bm,bs, respectively, the time A and b corresponding to the seconds. The title ensures that all data is valid.

Output for each test instance, outputs A+b, each output is also composed of time division seconds 3 parts, but also to meet the rules of the Times (that is, the value range of minutes and seconds in 0~59), each output is a row, and all the parts can be represented by 32-bit integers.
Sample Input
21 2 3 4 5 634 45 56 12 23 34

Sample Output
5 7 947) 9 30

Code:

Import java.util.*;p ublic class main{public static void Main (String args[]) {Scanner cin=new Scanner (system.in); int n=cin . Nextint (); int[] a=new int[6];for (int i=0;i<n;i++) {int y=0,m=0,d=0;for (int j=0;j<6;j++) a[j]=cin.nextint ();d =a [2]+a[5];if (d>60) {m=m+1;d=d-60;} M+=a[1]+a[4];if (m>60) {y=y+1;m=m-60;} Y+=A[0]+A[3]; System.out.println (y+ "" +m+ "" +d);}}}


HDU 2033 people see people love A+b (Java)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.