View Code of Problem 32

#include<stdio.h>
#include<math.h>
int main(){
	int i,L,X,Y,x[5],y[5],hp[5];
	float R;
	while(scanf("%d %d",&X,&Y)!=EOF){
		int flag=0;
		for(i=0;i<5;i++){
			scanf("%d %d %d",&x[i],&y[i],&hp[i]);
		}
		scanf("%d %f",&L,&R);
		for(i=0;i<5;i++){
			if(sqrt(pow(X-x[i],2)+pow(Y-y[i],2))<L){
				if(R*(sqrt(pow(X-x[i],2)+pow(Y-y[i],2)))>=hp[i]){
				flag=1;
				}
			}
		}
		if(flag==1)
		printf("YES\n");
		else
		printf("NO\n");
	}
}

Double click to view unformatted code.


Back to problem 32