PersonalCorpus 版 (精华区)
158444 11:17:44 9 Mar 2002
Bozhang,HIT,P.R.China 1125 Pascal Accepted 0.05 sec 61K
var
i,j,k,l,m,n:integer;
c:array[1..50,1..50] of char;
p:array[0..6400] of boolean;
pp:array[-50..50] of word;
begin
readln(m,n);
fillchar(p,sizeof(p),0);
for i:=0 to 50 do begin pp[i]:=i*i;pp[-i]:=pp[i];p[pp[i]]:=true end;
for i:=51 to 80 do p[i*i]:=true;
for i:=1 to m do begin
for j:=1 to n do read(c[i,j]);
readln;
end;
for i:=1 to m do begin
for j:=1 to n do begin
read(k);
if odd(k) then begin
for k:=1 to m do
for l:=1 to n do
if p[pp[k-i]+pp[l-j]] then if c[k,l]='B' then c[k,l]
:='W' else c[k,l]:='B';
end;
end;
readln;
end;
for i:=1 to m do begin
for j:=1 to n do begin
write(c[i,j]);
end;
writeln;
end;
end.
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:3.174毫秒