free pascal 马鞍数c:array[1..5,1..5] of integer; i,n,y,s:integer;begin y:=0; for n:= 1 to 5 do for i:= 1 to 5 do read (c[n,i]); for n:=1 to 5 do for i:=1 to 5 do begin for s:= 1 to 5 do begin if c[n,i] <= c[n,s] and c[n,i] >= c[s,i] then y:=
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/16 15:04:29
free pascal 马鞍数c:array[1..5,1..5] of integer; i,n,y,s:integer;begin y:=0; for n:= 1 to 5 do for i:= 1 to 5 do read (c[n,i]); for n:=1 to 5 do for i:=1 to 5 do begin for s:= 1 to 5 do begin if c[n,i] <= c[n,s] and c[n,i] >= c[s,i] then y:=
free pascal 马鞍数
c:array[1..5,1..5] of integer; i,n,y,s:integer;begin y:=0; for n:= 1 to 5 do for i:= 1 to 5 do read (c[n,i]); for n:=1 to 5 do for i:=1 to 5 do begin for s:= 1 to 5 do begin if c[n,i] <= c[n,s] and c[n,i] >= c[s,i] then y:=y+1; end; if y=5 then writeln(n,',',i); y:=0; end; readln;readln;end.这个程序问题在哪里?
free pascal 马鞍数c:array[1..5,1..5] of integer; i,n,y,s:integer;begin y:=0; for n:= 1 to 5 do for i:= 1 to 5 do read (c[n,i]); for n:=1 to 5 do for i:=1 to 5 do begin for s:= 1 to 5 do begin if c[n,i] <= c[n,s] and c[n,i] >= c[s,i] then y:=
前面应该加上var
if c[n,i] = c[s,i] 不对
正确:if (c[n,i] = c[s,i]) {用and时应该加上括号};
马鞍数:
5 6 7 8 9
4 5 6 7 8
3 4 5 2 1
2 3 4 9 0
1 2 5 4 8
试过好使
1,1是马鞍数.
program maan;
var c:array[1..5,1..5] of integer;
i,n,y,s:integer;
begin
y:=0;
for n:= 1 to 5 do
for i:= 1 to 5 do
read (c[n,i]);
for n:=1 to 5 do
for i:=1 to 5 do
begin
for s:= 1 to 5 do
begin
if (c[n,i] = c[s,i])
then y:=y+1;
end;
if y=5 then writeln(n,',',i);
y:=0;
end;
readln;readln;
end.