讨论 / 我的动归有问题吗
dislike 2009-08-11 15:39:00
点我顶贴 收藏 删除
var

a,b:array[0..200,1..200] of integer;

c:array[0..40000] of longint;

n,m,i,j,k,l:longint;

ch:char;

function min(x,y:longint):longint;

begin

if x<y then exit(x) else exit(y);

end;

begin

readln(n,m);

for i:=1 to n do

begin

for j:=1 to m do

begin

read(ch);

if ch=’1’ then a[i,j]:=1 else a[i,j]:=0;

end;

readln;

end;

for i:=1 to n do

for j:=1 to m do

if a[i,j]=1 then

begin

b[i,j]:=min(b[i,j-1],min(b[i-1,j],b[i-1,j-1]))+1;

for k:=1 to b[i,j] do inc(c[k]);

end;

readln(l);

for i:=1 to l do

begin

readln(j);

writeln(c[j]);

end;

end.

查看更多回复
提交回复