求救60分

P2010 [NOIP2016 普及组] 回文日期

笙瑟 @ 2017-03-19 18:40:19

const
  t:array[1..12] of longint=(31,29,31,30,31,30,31,31,30,31,30,31);
var
  f:array[1..100000000] of boolean;
  i,j,n,m,h:longint;
begin
  read(n,m);
  for i:=1 to 12 do
  for j:=1 to 31 do
  if t[i]>j then  
  f[10000000*(j mod 10)+1000000*(j div 10)+100000*(i mod 10)+10000*(i div 10)+100*i+j]:=true;
  for i:=n to m do
  if f[i] then
  inc(h);
  write(h);
end.

by orange0915 @ 2017-04-30 10:04:52

var q,r,s,t,u,a,b,c,d,e,f,g:longint;
begin 
 readln(q); 
 readln(r);  
 u:=0;  
 for s:= q to r do 
  begin 
   t:=s div 10000; 
   a:=s mod 10000;
   b:=a div 100; 
   c:=a mod 100;  
   d:=b div 10;   
   e:=b mod 10;  
   f:=c div 10;  
   g:=c mod 10; 
   if t=1000*g+100*f+10*e+d then u:=u+1; 
  end;  
  write(u);
end.

by orange0915 @ 2017-04-30 10:05:28

@刘国铖 这不科学


|