大神帮忙看下哪里错了

program huiwen;

var
month, ans, a, b, y, code, d: longint;
str1, str2, stry, strm, strd, year, s: string;

function judge(str1: string): boolean;
begin
if (str1[1] = str1[8]) and (str1[2] = str1[7]) and (str1[3] = str1[6]) and
(str1[4] = str1[5]) then
exit(True)
else
exit(False);
end;

begin
readln(a);
readln(b);
ans := 0;
if a <> b then
begin
str(a, str1);
stry := copy(str1, 1, 4);
strm := copy(str1, 5, 2);
strd := copy(str1, 7, 2);
str(b, str2);
if judge(str1) = True then
Inc(ans);
repeat
if (strm = '01') or (strm = '03') or (strm = '05') or (strm = '07') or
(strm = '08') or (strm = '10') or (strm = '12') then
month := 31
else if strm <> '02' then
month := 30
else
begin
year := stry;
val(year, y, code);
if ((y mod 4 = 0) and (y mod 100 <> 0)) or (y mod 400 = 0) then
month := 29
else
month := 28;
end;
if strd[1] = '0' then
begin
s := copy(strd, 2, 1);
val(s, d, code);
end
else
val(strd, d, code);
if (strm = '12') and (d = month) then
begin
Inc(y);
str(y, year);
strm := '00';
strd := '00';
end
else
if (strm[1] = '09') and (d = month) then
begin
strm := '00';
strd := '00';
end
else
if (d = month) then
begin
strm[2] := chr(Ord(strm[2]) + 1);
strd := '00';
end
else
begin
Inc(d);
str(d, strd);
if length(strd) = 1 then
strd := '0' + strd;
end;
str1 := stry + strm + strd;
if judge(str1) = True then
Inc(ans);
until str2 = str1;
end
else
begin
str(a, str1);
if judge(str1) = True then
Inc(ans);
end;
writeln(ans);
end.

0 条评论

目前还没有评论...

信息

ID
2010
难度
4
分类
(无)
标签
递交数
1320
已通过
327
通过率
25%
被复制
21
上传者