Please Help!90分,哪里有问题?

P2010 [NOIP2016 普及组] 回文日期

```delphi var s1,s2:string; tmp,s,i,t:longint; function max(year,month:longint):longint; begin case month of 1,3,5,7,8,10,12:exit(31); 4,6,9,11:exit(30); 2:exit(29); end; end; function check(year:longint):longint; var i,month,day,m,d,m1,d1:longint; begin month:=year mod 10*10+year div 10 mod 10; day:=year mod 1000 div 100*10+year div 1000; if (month<=12) and (day<=max(year,month)) and (month>0) and (day>0) then exit(1) else exit(0); end; begin readln(s1); readln(s2); {tmp:=1; s:=0; for i:=1 to 4 do if s1[i]<>s1[9-i] then begin tmp:=0; break; end; inc(s,tmp); if s1<>s2 then begin tmp:=1; for i:=1 to 4 do if s2[i]<>s2[9-i] then begin tmp:=0; break; end; inc(s,tmp);} s:=0; val(copy(s1,1,4),tmp); val(copy(s2,1,4),t); for i:=tmp{+1} to t{-1} do inc(s,check(i)); //end; writeln(s); end. ```
by Altria_Pendragon_ @ 2017-11-08 22:21:54


|