View Code of Problem 32

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int ming_x,ming_y; 
	int hero_x[5],hero_y[5],hero_hp[5];
	int L;
	double R;
	while(cin>>ming_x>>ming_y)
	{
		int flag=0;
		double distance[1001];
		for(int i=0;i<5;i++)
		{
			cin>>hero_x[i]>>hero_y[i]>>hero_hp[i];
		}
		cin>>L>>R;
		for(int i=0;i<5;i++)
		{
			distance[i]=sqrt(pow(hero_x[i]-ming_x,2)+pow(hero_y[i]-ming_y,2));
			if(L>distance[i]&&distance[i]*R>=hero_hp[i])
			{
				for(int j=0;j<5;j++)
				{
					if(i!=j&&hero_x[i]*hero_y[j]==hero_x[j]*hero_y[i])
					{
						flag=0;
					}
					else
					{
						flag=1;
						break;
					}
				}
			}
			i=5;
		}
		if(flag==0)
		{
			cout<<"No"<<endl; 
		}
		else
		{
			cout<<"Yes"<<endl;
		}
	}
}

Double click to view unformatted code.


Back to problem 32