View Code of Problem 32

#include<iostream>
#include<math.h>
using namespace std;
struct Hero{
	double x;
	double y;
	double hp;
	double len;
}; 
int main(){
	double a,b;
	while(cin>>a>>b){
		Hero ar[6];
		bool flag=false;
		for(int i=0;i<5;i++){
			scanf("%ld%ld%ld", &ar[i].x, &ar[i].y, &ar[i].hp);
			ar[i].len=(double)sqrt(pow(ar[i].x-a,2)+pow(ar[i].y-b,2));
		}
		double l;double R;
		scanf("%ld%ld", &l, &R);
		for(int i=0;i<5;i++){
			if(ar[i].len<=l){
				if(ar[i].hp<=R*ar[i].len){
					flag=true;
					break;
				}
			}
		}
		if(flag){
			cout<<"Yes"<<endl;
		}
		else{
			cout<<"No"<<endl;
		}
	}
}

Double click to view unformatted code.


Back to problem 32