Pagini recente » Cod sursa (job #242559) | Cod sursa (job #1534943) | Cod sursa (job #649621) | Cod sursa (job #1880224) | Cod sursa (job #253745)
Cod sursa(job #253745)
#include<stdio.h>
#define InFile "grendizer.in"
#define OutFile "grendizer.out"
#define Nmax 100001
struct
{
long double x,y;
}pct[Nmax];
inline abs(long double &x,long double &y)
{
if(x<0) x=-x;
if(y<0) y=-y;
}
int main()
{long double n,m,x1,y1,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++)
{x1=pct[j].x-x2; y1=pct[j].y-y2; abs(x1,y1);
mh=x1+y1;
if(mh==r) nr++;
}
printf("%ld\n",nr);
}
fclose(f); fclose(g);
return 0;
}