Title 6th period Difference

Source: Internet
Author: User

1 Importjava.util.Arrays;2 ImportJava.util.Comparator;3 ImportJava.util.Scanner;4 5  Public classmain{6      Public Static voidMain (String[]args) {7Date t=NewDate ();8T.year=0;9T.month=1;TenT.day=1; One         intCount=0; A          while(t.year!=5001){ -buf[t.year][t.month][t.day]=count; - t.nextdate (); thecount++; -         } -          -Scanner in=NewScanner (system.in); +          while(In.hasnext ()) { -String day=in.nextline (); +String y=day.substring (0, 4); A             inty_=integer.valueof (y); atString m=day.substring (4, 6); -             intm_=integer.valueof (m); -String d=day.substring (6, 8); -             intd_=integer.valueof (d); -             intx1=Buf[y_][m_][d_]; -day=in.nextline (); inY=day.substring (0, 4); -y_=integer.valueof (y); toM=day.substring (4, 6); +m_=integer.valueof (m); -D=day.substring (6, 8); thed_=integer.valueof (d); *              intX2=Buf[y_][m_][d_]; $System.out.println (Math.Abs (x1-x2) +1);Panax Notoginseng         } -      } the     Private Static intIsyeap (intx) { +         if(x%4==0&&x%100!=0| | x%400==0)return1; A         Else return0; the     } +     Private Static int[][]dayofmonth={ -{0,0}, ${31,31}, ${28,29}, -{31,31}, -{30,30}, the{31,31}, -{30,30},Wuyi{31,31}, the{31,31}, -{30,30}, Wu{31,31}, -{30,30}, About{31,31} $     }; -     Private Static classdate{ -         intYear ; -         intmonth; A         intDay ; +         voidnextdate () { theday++; -             if(day>Dayofmonth[month][isyeap (year)]) { $Day=1; themonth++; the             } the             if(month>12){ theMonth=1; -year++; in             } the         } the     } About     Private Static int[][][]buf=New int[5001] [13] [32]; the}

Title 6th period Difference

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.