linlin @ 2017-11-11 10:45:45
rt,我怎么改都是70分,错的数据全部少1,求教!
var y,w,sd,ed,s,d:string;
a:array[1..12] of longint=(31,28,31,30,31,30,31,31,30,31,30,31);
i,j,n,sum,m,start,en:longint;
function t(r:string):boolean;
begin
t:=false;
y:=r[4]+r[3];
val(y,n);
if(n<=12)and(n>=1) then
begin
w:=r[2]+r[1];
val(w,m);
if (m<=a[n])and(m>=1) then t:=true;
end;
end;
begin
readln(sd);
readln(ed);
y:=sd[1]+sd[2]+sd[3]+sd[4];
w:=ed[1]+ed[2]+ed[3]+ed[4];
val(y,start);
val(w,en);
for i:=start to en do
begin
str(i,d);
if t(d) then inc(sum);
end;
writeln(sum);
end.
by 慕柒宝宝 @ 2017-11-11 10:52:11
把~那个~东西换掉
by linlin @ 2017-11-11 10:52:45
@慕柒宝宝 什么玩意
by Lazarus_Long @ 2017-11-11 11:50:44
啊呀呀,你从开始日期到结束日期枚举是要超时的!,应该先生成回文日期再进行枚举。
by Seauy @ 2018-03-30 13:06:31
@Lazarus_Long 并不233,其实枚举是不会超时的