讨论 / 才20分...请大神帮看看代码
qq948938124 2013-10-26 19:36:00
点我顶贴 收藏 删除
var

a:array[1..1000,1..1000]of boolean;

b:array[1..100000000]of longint;

w,h,k,l,o,p,q:int64;

i,j,m,n:longint;

d,e:real;

procedure xh(l:longint);

var

i,j,ij,m,n,mn:longint;

begin

if l=k then

begin

o:=o+1;

b[o]:=0;

for i:=1 to w do

for j:=1 to h do

if a[i,j]=true then

begin

b[o]:=b[o]+1;

a[i,j]:=false;

end;

exit;

end;

l:=l+1;

for i:=1 to w do

for j:=1 to w do

for m:=1 to h do

for n:=1 to h do

begin

if (i<=j) and (m<=n) then

for ij:=i to j do

for mn:=m to n do

a[ij,mn]:=true;

if (i<= j) and (m>n) then

for ij:=i to j do

for mn:=n to m do

a[ij,mn]:=true;

if (i>j) and (m<=n) then

for ij:=j to i do

for mn:=m to n do

a[ij,mn]:=true;

if (i>j) and (m>n) then

for ij:=j to i do

for mn:=n to m do

a[ij,mn]:=true;

xh(l);

end;

end;

begin

read(k,w,h);

l:=0;

o:=0;

xh(0);

p:=0;

for i:=1 to o do

p:=p+b[i];

write(p/o:0:0);

end.

#1 qq948938124@2013-10-26 19:36:00
回复 删除
717 矩阵粉刷

忘写题目了。。

查看更多回复
提交回复