n,m,i,j,ss:longint;
a:array[0..100,0..100]of longint;
function s(i,j:longint):boolean;
begin
if (a[i-1,j]>0) and (a[i,j-1]>0) and (a[i+1,j]>0) and (a[i,j+1]>0) then
exit(true);
exit(false);
end;
begin
read(n,m);
for i:=1 to n do
for j:=1 to m do
begin
read(a[i,j]);
if a[i,j]>0 then a[i,j]:=1;
end;
a[0,1]:=1;
a[0,2]:=1;
a[0,0]:=1;
a[0,3]:=1;
a[0,4]:=1;
a[1,0]:=1;
a[2,0]:=1;
a[3,0]:=1;
a[4,0]:=1;
ss:=0;
for i:=1 to n do
for j:=1 to m do
if s(i,j)=true then ss:=ss+1;
write(ss);
end.
[color=blue]
是不是我的题目理解出错了啊!各位高手看看呐~到底哪儿错了啊???
[color=red]
本人是个新手,代码很难看不要介意啊~嘻嘻。。。。
a[0,1]=1;
a[0,2]=1;
a[0,0]=1;
a[0,3]=1;
a[0,4]=1;
a[1,0]=1;
a[2,0]=1;
a[3,0]=1;
a[4,0]=1;
问:为何不循环到n(m)?n,m=4只是个样例
[color=green]解释下,什么意思啊。。。。
[color=blue]为啥每次回答看见滴都是你呐~~惊讶撒~
我写个C++(看不懂我没办法,不会写Pascal)
for (i=1;i<=n;i++) a[0][i]=0;
for (i=1;i<=m;i++) a[0][j]=0;
a[0][0]=0;
另外我有管理员号,随时来转转有没有人乱发帖子,同时去答疑
[color=red]
C++真心看不懂,我pascal都有些看不懂,肿么可能看懂撒= =嘻嘻,不要介意桑。。。
[color=blue]
昂,我可以申请管理撒= =????!!