View Code of Problem 32

#include<iostream>
#include<cstring>
#include<algorithm>
#include<queue>
#include<stdio.h>
#include<string.h>
#include<cmath>
using namespace std;
struct hero{
   int x,y;
   int hp;
};
int main()
{
    int x,y;
    while(scanf("%d%d",&x,&y)!=EOF)
    {
        hero h[6];
        for(int i=0;i<6;i++)
            cin>>h[i].x>>h[i].y>>h[i].hp;
        int dis;
        double r;
        cin>>dis;
        scanf("%lf",&r);
        int flag=0;
        for(int i=0;i<6;i++)
        {
            double  juli=sqrt((h[i].x-x)*(h[i].x-x)+(h[i].y-y)*(h[i].y-y));
            if(juli>dis)
                continue;
            else if(h[i].hp>juli*r)
                continue;
            else {
                    int cnt=0;
                for(int j=0;j<6;j++)
                {
                    if(i==j)
                        continue;
                    if((h[i].x-x)*(h[j].y-y)==(h[i].y-y)*(h[i].x-x))
                    {
                        double qw=sqrt((h[j].x-x)*(h[j].x-x)+(h[j].y-y)*(h[j].y-y));
                        if(qw<juli&&h[j].hp>qw*r)
                         {
                             cnt=1;break;
                         }
                    }
                }
                if(cnt) continue;
                else {flag=1;}
            }
            if(flag)
                break;
                //int a;
                //cin>>a;
        }
        if(flag) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
   return 0;
}

Double click to view unformatted code.


Back to problem 32