NOIP2014无线网络发射选址【Pascal】

其实,一看数据范围,水过就好,

乱搞模拟就可以过=。=

var
    d,n,ans,x,y,sum,t   :longint;
    i,j,k,l             :longint;
    map                 :array[0..200,0..200] of longint;
begin
   read(d);
   read(n);
   for i:=1 to n do
   begin
      read(x,y);
      inc(x);
      inc(y);
      read(map[x,y]);
   end;
   for i:=1 to 129 do
    for j:=1 to 129 do
    begin
       t:=0;
       for k:=-d to d do
        for l:=-d to d do
         if (i+k<=129) and (i+k>=1)
          and (j+l<=129) and (j+l>=1) then inc(t,map[i+k,j+l]);
          //
      if (t>ans) then
      begin
         ans:=t;
         sum:=1;
      end else
      if (t=ans) then inc(sum);
   end;
   writeln(sum,' ',ans);
end.
——by Eirlys

你可能感兴趣的:(noip复赛=A=)