Pagini recente » Cod sursa (job #544573) | Cod sursa (job #2545990) | Cod sursa (job #2401605) | Cod sursa (job #1548390) | Cod sursa (job #253730)
Cod sursa(job #253730)
#include<stdio.h>
#include<math.h>
#define InFile "grendizer.in"
#define OutFile "grendizer.out"
#define Nmax 100001
struct
{
long double x,y;
}pct[Nmax];
int main()
{long double n,m,x2,y2,r,mh;
unsigned long i,j,nr;
FILE *f=freopen(InFile,"r",stdin),*g=freopen(OutFile,"w",stdout);
scanf("%lf %lf",&n,&m);
for(i=1;i<=n;i++) scanf("%lf %lf",&pct[i].x,&pct[i].y);
for(i=1;i<=m;i++)
{scanf("%lf %lf %lf",&x2,&y2,&r); nr=0;
for(j=1;j<=n;j++)
{mh=abs(pct[j].x-x2)+abs(pct[j].y-y2);
if(mh==r) nr++;
}
printf("%ld\n",nr);
}
fclose(f); fclose(g);
return 0;
}