View Code of Problem 32

#include<bits/stdc++.h>
using namespace std;
struct hero{
	double x;
	double y;
	double hp;
};
int main(){
	double X,Y,L,R;
	while(cin>>X>>Y){
		hero h[5];
		for(int i=0;i<5;i++){
			scanf("%ld%ld%ld", &h[i].x, &h[i].y, &h[i].hp);
		}
		scanf("%ld%ld", &L, &R);//钩长和伤害系数 
		for( int i=  0;i < 5;i++){
			double d = sqrt( ( h[i].x - X) * ( h[i].x - X) + ( h[i].y - Y) * (h[i].y - Y));
			if( L >= d && d * R >= h[i].hp ){
				cout<<"Yes"<<endl;
				break;
		   	}
			else if(i>=4){
				cout<<"No"<<endl; 
				break;
			}
		}
 	}
 	return 0;
}

Double click to view unformatted code.


Back to problem 32