View Code of Problem 32

#include<stdio.h>
#include<math.h>
typedef struct 
{
	int x;
	int y;
	int hp;
}Dota;

int main()
{
	int x0, y0, L,flag=0;
	double R,K;
	Dota dota[5];
	while (scanf("%d%d", &x0, &y0) != EOF)
	{
		flag = 0;
		for (int i = 0; i < 5; i++)
		{
			scanf("%d %d %d", &dota[i].x, &dota[i].y, &dota[i].hp);
		}
		scanf("%d %lf", &L, &R);
		for (int i = 0; i < 5; i++)
		{
			K = 0.0+(dota[i].x - x0)*(dota[i].x - x0) + (dota[i].y - y0)*(dota[i].y - y0);
			if (K <= R*R)
				if (sqrt(K)*R- dota[i].hp >= 0)
				{
					printf("YES\n");
					flag = 1;
					break;
				}
		}
		if (flag == 0)
			printf("NO\n");

	}
}

Double click to view unformatted code.


Back to problem 32