View Code of Problem 32

#include<bits/stdc++.h>
using namespace std;

struct di{
	int x,y,hp;
	double len;
};

int main() {

	int x,y;
	while(scanf("%d %d",&x,&y)!=EOF){
		di hero[5];
		for(int i=0;i<5;i++){
			scanf("%d %d %d",&hero[i].x,&hero[i].y,&hero[i].hp);
			hero[i].len=sqrt((hero[i].x-x)*(hero[i].x-x)+(hero[i].y-y)*(hero[i].y-y));
		}
		int l;
		double r;
		scanf("%d %lf",&l,&r);
		int num=0;
		for(int i=0;i<5;i++){
			if(hero[i].len*r>=hero[i].hp&&hero[i].len<=l){
				num=1;
				break;
			}
		}
		if(num==0){
			printf("No\n"); 
		}else{
			printf("Yes\n"); 
		}
	}

	return 0;
}

Double click to view unformatted code.


Back to problem 32