View Code of Problem 32

#include <stdio.h>
#include <math.h>
#define N 5
int main()
{
	int X, Y, x[N], y[N], hp[N], L;
	float R;
	int k = 0, i;
	while(scanf("%d %d", &X, &Y) != EOF)
	{
		for(i = 0; i < 5; i++)
			scanf("%d %d %d", &x[i], &y[i], &hp[i]);
		scanf("%d %f", &L, &R);
		for(i = 0; i < 5; i++)
		{
			float d[N];
			d[i] = (float)sqrt((x[i] - X) * (x[i] - X) + (y[i] - Y) * (y[i] - Y));
			if(d[i] <= L && d[i] * R >= hp[i])
				k++;
		}
		if(k != 0)
			printf("YES\n");
		else 
			printf("NO\n");
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 32