Cod sursa(job #253675)

Utilizator chelaru_t_achelaru traian andrei chelaru_t_a Data 6 februarie 2009 11:02:49
Problema Grendizer Scor 0
Compilator fpc Status done
Runda Stelele Informaticii 2009, clasele 9-10, ziua 1 Marime 0.69 kb
type coord=record
           x,y:longint;
           end;
var v:array [1..100000] of coord;
    n,m,i,r,x,y,nr,j:longint;
    f,g:text;

 procedure citire;
  var i:longint;
  begin
   readln(f,n,m);
   for i:=1 to n do readln(f,v[i].x,v[i].y);
  end;

 function obiectiv(a,b:longint):integer;
  var d:longint;
  begin
   d:=abs(a-x)+abs(b-y);
   if d<=r then obiectiv:=1
   else obiectiv:=0;
  end;

begin
  assign(f,'grendizer.in');
  assign(g,'grendizer.out');
  reset(f);
  rewrite(g);
  citire;
  for i:=1 to m do
    begin
    readln(f,x,y,r);
    nr:=0;
    for j:=1 to n do nr:=nr+obiectiv(v[j].x,v[j].y);
    writeln(g,nr);
    end;
  close(f);
  close(g);
end.