View Code of Problem 32

#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
int main(){
	int i;
	int X,Y;
	int x[5],y[5],hp[5];
  while(scanf("%d %d",&X,&Y)!=EOF){
  	
	for( i=0;i<5;i++){
		scanf(" %d %d %d",&x[i],&y[i],&hp[i]);
	}
    int L;
	double s;
	double R;
	
	scanf(" %d %lf",&L,&R);
	
	int flag=0;
	for(i=0;i<5;i++){
		s=sqrt((x[i]-X)*(x[i]-X)+(y[i]-Y)*(y[i]-Y));
		if(s<=L&&hp[i]<=R*s){
			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