不是VIP会员,不能显示答案

题目解答

题目:
Program exp2 (input,output);
Const n=5;
Var i,j,k : integer;
a : array[1..2*n, 1..2*n] of integer;
Begin
K:=1;
For I:=1 to 2*n-1 do
If i<=n then
if odd(i) then
for j:= I downto 1 do
begin
a [I-j+1,j]:=k; k:=k+1
end
else for j: =1 to i do
begin
a[i-j+1,j]:=k; k:=k+1;
end
else if odd(i) then for j:=n downto I-n+1 do
begin
a[I-j+1,j]:=k; k:=k+1;
end
else for j:=I-n+1 to n do
begin
a[I-j+1,j]:=k; k:=k+1;
end;
for I:=1 to n do
begin
for j:=1 to n do
write(a[I,j]:3);
writeln
end;
end.
输出: 1 3 4 10 11
2 5 9 12 19
6 8 13 18 20
7 14 17 21 24
15 16 22 23 25
考点:
分析:
解答:
评论:
老师: