View Code of Problem 32

#include<stdio.h>
#include<math.h>

int main(){
	int i,a,b,l,flag;
    double s[5],r,sh;
	int x[5],y[5],hp[5];
	while(scanf("%d%d",&a,&b)!=EOF)
	{
	  for(i=0;i<5;i++)
	  {
		  scanf("%d%d%d",&x[i],&y[i],&hp[i]);
		  s[i]=sqrt(1.0*(a-x[i])*(a-x[i])+1.0*(b-y[i])*(b-y[i]));
	  }
	      scanf("%d%lf",&l,&r);		  
		  for(flag=0,i=0;i<5;i++)
		  {
		    sh=s[i]*r;
		    if (sh>=1.0*hp[i]&& l*1.0 >=s[i])
			{
			  flag=1;
			  break;
			}
		  }
		  if(flag==1)
			  printf("Yes\n");
		  else
			  printf("No\n");		  
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 32