Cod sursa(job #253706)

Utilizator GheorgheMihaiMihai Gheorghe GheorgheMihai Data 6 februarie 2009 11:37:22
Problema Grendizer Scor 0
Compilator cpp Status done
Runda Stelele Informaticii 2009, clasele 9-10, ziua 1 Marime 0.57 kb
#include<stdio.h>
#include<math.h>
struct point
  {
  long x,y;
  };
long n,m;
point v[1010]; // v[100010]


void read()
{
freopen("grendizer.in","r",stdin);
freopen("grendizer.out","w",stdout);
scanf("%ld%ld",&n,&m);
long i,j,x,y,r,nr;
for(i=1;i<=n;i++)
  {
  scanf("%ld",&x);
  scanf("%ld",&y);
  v[i].x=x;
  v[i].y=y;
  }
for(i=1;i<=m;i++)
  {
  nr=0;
  scanf("%ld",&x);
  scanf("%ld",&y);
  scanf("%ld",&r);
  for(j=1;j<=n;j++)
    if(labs(v[j].x-x)+labs(v[j].y-y)==r)
      nr++;
  printf("%ld\n",nr);
  }
}


int main()
{
read();
return 0;
}