View Code of Problem 32

#include<stdio.h>
#include<math.h>
struct hero
{
	int x;
	int y;
	int hp;
	double t;
};
void main()
{
	int X,Y;
	while(scanf("%d %d",&X,&Y)!=EOF)
	{
		int i,L;
		double R;
		struct hero h[5];
		for(i=0;i<5;i++)
		{
			scanf("%d %d %d",&h[i].x,&h[i].y,&h[i].hp);
		}
		scanf("%d %llf",&L,&R);
		h[0].t=sqrt((h[0].x-X)*(h[0].x-X)+(h[0].y-Y)*(h[0].y-Y));
		h[1].t=sqrt((h[1].x-X)*(h[1].x-X)+(h[1].y-Y)*(h[1].y-Y));
		h[2].t=sqrt((h[2].x-X)*(h[2].x-X)+(h[2].y-Y)*(h[2].y-Y));
		h[3].t=sqrt((h[3].x-X)*(h[3].x-X)+(h[3].y-Y)*(h[3].y-Y));
		h[4].t=sqrt((h[4].x-X)*(h[4].x-X)+(h[4].y-Y)*(h[4].y-Y));
		int flag=0;
		for(i=0;i<5;i++)
		{
			if(h[i].t<=L)
			{
				if(R*h[i].t>=h[i].hp)
				{
					flag=1;
					break;
				}
			}
		}
		if(flag==0)
		{
			printf("No\n");
		}else
		{
			printf("Yes\n");
		}
	}
}

Double click to view unformatted code.


Back to problem 32