问题:
程序如下:procedure init;
begin
assign(output,'friday.out'); rewrite(output);
end;
function days(x,y:longint):longint;
begin
case y of
1,3,5,7,8,10,12:days:=31;
4,6,9,11:days:=30;
2:if ((x mod 4=0) and (x mod 100<>0)) or (x mod 400=0) then days:=29 else days:=28;
end;
end;
procedure print;
var i,j,k,m,n,ans:longint;
begin
n:=6; ans:=0;
for i:=1990 to 1999 do
for j:=1 to 12 do
begin
k:=days(i,j);
repeat
if n=7 then n:=1
else inc(n);
inc(ans);
if (n=5) and (ans=13) then writeln(i,j,k);
until k=ans;
end;
close(output);
end;
begin
init;
print;
end.
图片: