Pagini recente » Cod sursa (job #689063) | Cod sursa (job #2519031) | Cod sursa (job #255771) | Cod sursa (job #269105) | Cod sursa (job #253794)
Cod sursa(job #253794)
#include<fstream.h>
#include<math.h>
#define dim 501
ifstream f("grendizer.in");
ofstream g("grendizer.out");
struct puncte
{int x;
int y;
};
puncte v[dim];
int main()
{
int n,m,i,j;
long rx,ry,dist,r,contor;
f>>n>>m;
for(i=1;i<=n;i++)
f>>v[i].x>>v[i].y;
for(i=1;i<=m;i++)
{
f>>rx>>ry>>r;
contor=0;
for(j=1;j<=n;j++)
{
dist=abs(v[j].x-rx)+abs(v[j].y-ry);
if(dist==r) contor++;
}
g<<contor<<'\n';
}
f.close();
g.close();
return 0;
}