- 扫雷游戏
- 2016-10-25 16:43:50 @
// input code here
```Program p1975(input,output);
Var
a:array[0..100,0..100]of integer;
b:array[0..100,0..100]of char;
i,j,m,n,count:integer;
Begin
readln(n,m);
for i:=0 to 100 do
for j:=0 to 100 do
a[i,j]:=0;
for i:=1 to n do
begin
for j:=1 to m-1 do
begin
read(b[i,j]);
if b[i,j]='*' then a[i,j]:=1
else a[i,j]:=0;
end;
readln(b[i,m]);
if b[i,m]='*' then a[i,m]:=1
else a[i,m]:=0;
end;
for i:=1 to n do
begin
for j:=1 to m do
if b[i,j]<>'*' then
begin
count:=a[i,j-1]+a[i,j+1]+a[i-1,j-1]+a[i-1,j]+a[i-1,+j+1]+a[i+1,j-1]+a[i+1,j]+a[i+1,j+1];
write(count);
end
else
write('*');
writeln;
end;
readln;
End.
0 条评论
目前还没有评论...