我擦

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:50:38

@[url=/usershow?uid=12]hongweixin[/url]


by 一碗粥 @ 2013-09-19 23:51:05

综上所述

数据弱爆了


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

给你1000*1000看你怎么过。


by Re验证码 @ 2013-09-20 09:48:11

[color=Purple]没事写这题……[/color]


by 发源于 @ 2013-09-20 18:37:39

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

你怎么暴力的?

不是应该在外面添一层0然后种子染色吗?

把外面的0全填成3

然后打印

打印时3打0,0打2


by UnyieldingTrilobite @ 2020-07-05 14:43:38

考古


by Wang1006 @ 2021-08-23 13:42:39

考古《古代人考古》


by MLE__125MB @ 2023-07-13 20:02:01

ME TOO


by taojiayu @ 2024-01-07 16:27:23

大考古


上一页 |