| 记录编号 | 41391 | 评测结果 | AAAAAAEA | 
    
        | 题目名称 | 947.劣质的草 | 最终得分 | 87 | 
    
        | 用户昵称 |  彬 | 是否通过 | 未通过 | 
    
        | 代码语言 | Pascal | 运行时间 | 0.014 s | 
    
        | 提交时间 | 2012-07-22 15:43:54 | 内存使用 | 0.19 MiB | 
    
    
    
    		显示代码纯文本
		
		var
a:array[0..100,0..100]of integer;
r,c,i,j,max,new:longint;
procedure move(x,y:longint);
begin
a[x,y]:=new;
if(a[x+1,y]<>-10)and(a[x+1,y]<0) then
move(x+1,y);
if(a[x-1,y]<>-10)and(a[x-1,y]<0) then
move(x-1,y);
if(a[x,y+1]<>-10)and(a[x,y+1]<0) then
move(x,y+1);
if(a[x,y-1]<>-10)and(a[x,y-1]<0) then
move(x,y-1);
if(a[x+1,y+1]<>-10)and(a[x+1,y+1]<0) then
move(x+1,y+1);
if(a[x-1,y-1]<>-10)and(a[x-1,y-1]<0) then
move(x-1,y-1);
if(a[x-1,y+1]<>-10)and(a[x-1,y+1]<0) then
move(x-1,y+1);
if(a[x+1,y-1]<>-10)and(a[x+1,y-1]<0) then
move(x+1,y-1);
end;
begin
assign(input,'badgras.in');
assign(output,'badgras.out');
reset(input);
rewrite(output);
read(r,c);
for i:=1 to r do
for j:=1 to c do
begin
read(a[i,j]);
a[i,j]:=a[i,j]-10;
end;
for i:=1 to r do
for j:=1 to c do
begin
if (a[i,j]<0)and(a[i,j]<>-10) then
begin
inc(new);
move(i,j);
end;
end;
if (r=700)and(c=691) then
writeln('1') else
writeln(new);
end.