数据点9有毒???

P2010 [NOIP2016 普及组] 回文日期

ling @ 2016-12-17 19:13:00

var
  n,m,y1,y2,sum,i:longint;
function fanzhuan(b:longint):longint;
var
  s,s1:string;
  num,p,j:longint;
begin
  str(b,s);
  num:=0;
  for j:=length(s) to 1 do
  begin
    inc(num);
    s1[num]:=s[j];
  end;
  val(s1,p);
  exit(p);
end;
function panduan(a:longint):boolean;
var
  m,m1,d,d1:longint;
begin
  if a=9220 then exit(true);
  m:=a mod 100;
  m1:=m div 10+(m mod 10)*10;
  d:=a div 100;
  d1:=d div 10+(d mod 10)*10;
  if (m1>12) or (m1=0) then exit(false)
  else
  begin
    if (m1=1) or (m1=3) or (m1=5) or (m1=7) or (m1=8) or (m1=10) or (m1=12) then
      if (d1<=31) and (d1>0) then exit(true) else exit(false);
    if (m1=4) or (m1=6) or (m1=9) or (m1=11) then
      if (d1<=30) and (d1>0) then exit(true) else exit(false);
    if m1=2 then
      if (d1<=28) and (d1>0) then exit(true) else exit(false);
  end;
end;
begin
  read(n,m);
  y1:=n div 10000;
  y2:=m div 10000;
  sum:=0;
  if panduan(y1)=true then
    if fanzhuan(y1)>=y1 then inc(sum);
  if panduan(y2)=true then
    if fanzhuan(y2)<=y2 then inc(sum);
  for i:=y1+1 to y2-1 do
    if panduan(i)=true then inc(sum);
  writeln(sum);
end.

90 90 90 ……


|