View Code of Problem 32

#include <cstdio>
#include <cmath>
#include <iostream>
using namespace std;

struct hero{
	int x;
	int y;
	int hp;
};

int main(){
	int posx,posy;
	while(cin>>posx>>posy){
		hero heros[5]={};
		for(int i=0;i<5;i++){
			cin>>heros[i].x>>heros[i].y>>heros[i].hp;	
		}
		int l;
		double r;
		cin>>l>>r;
		int flag=0;
		for(int i=0;i<5;i++){
			double dis=dis=sqrt((heros[i].x-posx)*(heros[i].x-posx))+((heros[i].y-posy)*(heros[i].y-posy));
			double hurt=r*dis;
			if(dis<=l){//在射程
				
				if(heros[i].hp<=hurt){
					flag=1;
					break;
				} 
			}
		}
		if(flag==1)
			cout<<"Yes"<<endl;
		else
			cout<<"No"<<endl;
		 
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 32