题目: |
program test2;
var a:array[1..8,1..8]of integer;
i,j,sum:integer;
begin
for i:=1 to 8 do
begin
for j:=1 to 8 do read(a[i,j]);
readln;
end;
sum:=0;
for i:=1 to 8 do
for j:=1 to 8 do
if (i=j) or (i+j=9) then sum:=sum+a[i,j];
writeln(sum);
end.
输入:2 3 4 5 6 1 0 9
4 5 6 2 1 4 9 4
9 8 7 6 4 5 2 3
5 6 7 8 2 1 2 3
8 9 0 0 3 4 5 2
9 8 5 6 7 8 9 0
2 3 2 2 2 1 2 3
6 6 6 6 6 6 6 6 输出:80
|