我擦

P1162 填涂颜色

一碗粥 @ 2013-09-19 23:19:10

var i,j,k1,k2,k3,k4,l,m,n,sum:longint;
    a:array[1..50,1..50]of longint;
begin
  read(n);
  for i:=1 to n do
  for j:=1 to n do read(a[i,j]);
  for i:=2 to n-2 do
  begin
    for j:=2 to n-2 do
    begin
      if a[i,j]=0 then
      begin
        for k1:=j downto 1 do
        begin
          if a[i,k1]=1 then begin inc(sum);break;end;
        end;
        for k2:=j to n do
        begin
          if a[i,k2]=1 then begin inc(sum);break;end;
        end;
        for k3:=i downto 1 do
        begin
          if a[k3,j]=1 then begin inc(sum);break;end;
        end;
        for k4:=i to n do
        begin
          if a[k4,j]=1 then begin inc(sum);break;end;
        end;
        if sum mod 4=0 then a[i,j]:=2;
      end;
    end;
  end;
  for i:=1 to n do
  begin
    for j:=1 to n do
    begin
      write(a[i,j],' ');
    end;
    writeln;
  end;
end.

本人垃圾一只 暴力 求解为什么只差一个数啊

@[url=/usershow?uid=32]洋葱头[/url]

@墨凝而至

@[url=/usershow?uid=11]vip999[/url]

@[url=/usershow?uid=51]YanjunchenEdward[/url]

@[url=/usershow?uid=38](Beta)857164819[/url]


by 一碗粥 @ 2013-09-19 23:19:41

@[url=/usershow?uid=39]墨凝而止[/url]


by 一碗粥 @ 2013-09-19 23:20:09

@[url=/usershow?uid=16]li20082008li[/url]


by 一碗粥 @ 2013-09-19 23:21:36

暴力循环不行?


by 洋葱头 @ 2013-09-19 23:33:22

@[url=/usershow?uid=35]一碗粥[/url]

干嘛要写这一题呀?


by 一碗粥 @ 2013-09-19 23:38:45

你全家都没事干

@[url=/usershow?uid=32]洋葱头[/url]

写搜索啊


by 洋葱头 @ 2013-09-19 23:39:34

@[url=/usershow?uid=35]一碗粥[/url]


by hongweixin @ 2013-09-19 23:42:36

你想用暴力过,想太多了


by 一碗粥 @ 2013-09-19 23:48:46

过了 @洋葱头


by 一碗粥 @ 2013-09-19 23:49:09

暴力过了

@[url=/usershow?uid=32]洋葱头[/url]


by 一碗粥 @ 2013-09-19 23:50:19

yct sorry

过了 hongweixin

@hongweixin


| 下一页