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

题目解答

题目:
program test04;
var
i,j,s,h,v,n:integer;
a:array[1..20,1..20] of integer;
begin
readln(n,h,v);
for i:=1 to n do
begin
for j:=1 to n do read(a[i,j]);readln;
end;
s:=0;
for i:=1 to n do
if i=h then for j:=1 to n do s:=s+a[i,j];
for j:=1 to n do
if j=v then for i:=1 to n do s:=s+a[i,j];
if h<=v then
for i:=1 to n-(v-h) do s:=s+a[i,i+v-h]
else for j:=1 to n-(h-v) do s:=s+a[j+h-v,j];
for i:=1 to 2 do s:=s-a[h,v];
writeln(s);
end.
输入:
8 5 3
2 16 18 5 13 13 14 0
3 15 19 14 12 16 5 11
9 1 5 6 1 14 7 5
1 2 6 5 2 12 4 8
3 13 10 1 10 1 12 18
1 5 0 1 4 6 18 0
19 15 7 4 0 2 12 13
8 15 17 0 2 11 16 16
输出:163
考点:
分析:
解答:
评论:
老师: