#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++){ // int ss=((heros[i].x-posx)*(heros[i].x-posx))+((heros[i].y-posy)*(heros[i].y-posy));//这里出错了!!! double dis=sqrt((heros[i].x-posx)*(heros[i].x-posx))+((heros[i].y-posy)*(heros[i].y-posy)); if(dis<=l){//在射程 double hurt=r*dis; 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.