View Code of Problem 32

#include <iostream>
#include <math.h>
using namespace std;
 
int main(int argc, char const *argv[])
{
	int X,Y,x[5],y[5],ph[5],L;
	double R,dis,dam;
	bool flag;
	while(scanf("%d %d",&X,&Y)!=EOF){
		for (int i = 0; i < 5; i++)
			scanf("%d %d %d",&x[i],&y[i],&ph[i]);
		scanf("%d %lf",&L,&R);
 
		flag = false;
 
		for (int i = 0; i < 5; i++)
		{
			dis = sqrt((x[i]-X)*(x[i]-X)+(y[i]-Y)*(y[i]-Y));
			if (L>=dis)
			{
				dam = R * dis;
				if (dam>=ph[i])
				{
					printf("Yes\n");
					flag = true;
					break;
				}
			}
		}
          
		if (!flag)
			printf("No\n");
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 32