主题:信息学奥赛求救
我是一初二学生,最近在准备信息奥赛,做历届的试题,遇到一个大问题:第十届普及组初赛的程序阅读题4。不了解这个程序具体是怎么循环以及实现什么?
源程序粘贴:
program program4;
var c:array[1..2] of string[200];
s:array[1..10] of integer;
m,n,i:integer;
procedure numara;
var cod:boolean;
i,j,nr:integer;
begin
for j:=1 to n do begin
nr:=0;cod:=true;
for i:=1 to m do
if c[i,j]=''''1'''' then begin
if not cod then begin
cod:=true;inc(s[nr]);nr:=0;
end
end
else begin
if cod then begin
nr:=1;cod:=false;
end
else inc(nr);
end;
if not cod then inc(s[nr]);
end;
end;
begin
readln(m,n);
for i:=1 to m do readln(c[i]);
numara;
for i:=1 to m do
if s[i] <>0 then write(i,'''' '''',s[i],'''' '''');
end.
输入:3 10
1110000111
1100001111
1000000011
问题:s[i]表示什么,c[i,j]是怎么循环的是行循环还是列循环?
恳请各位大侠指点:每一个语句是实现什么要求
源程序粘贴:
program program4;
var c:array[1..2] of string[200];
s:array[1..10] of integer;
m,n,i:integer;
procedure numara;
var cod:boolean;
i,j,nr:integer;
begin
for j:=1 to n do begin
nr:=0;cod:=true;
for i:=1 to m do
if c[i,j]=''''1'''' then begin
if not cod then begin
cod:=true;inc(s[nr]);nr:=0;
end
end
else begin
if cod then begin
nr:=1;cod:=false;
end
else inc(nr);
end;
if not cod then inc(s[nr]);
end;
end;
begin
readln(m,n);
for i:=1 to m do readln(c[i]);
numara;
for i:=1 to m do
if s[i] <>0 then write(i,'''' '''',s[i],'''' '''');
end.
输入:3 10
1110000111
1100001111
1000000011
问题:s[i]表示什么,c[i,j]是怎么循环的是行循环还是列循环?
恳请各位大侠指点:每一个语句是实现什么要求