Pagini recente » Cod sursa (job #2803091) | Cod sursa (job #1623691) | Cod sursa (job #39033) | Cod sursa (job #3128727) | Cod sursa (job #253749)
Cod sursa(job #253749)
#include "stdafx.h"
#include<stdio.h>
#define InFile "grendizer.in"
#define OutFile "grendizer.out"
#define Nmax 100001
struct
{
long double x,y;
}pct[Nmax];
void 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;
}