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