View Code of Problem 32

#include <iostream>
#include <math.h>
using namespace std;

int main(int argc, char const *argv[])
{
	int X,Y,x[4],x[4],ph[4],L;
	double R,dis,dam;
	bool flag;
	while(scanf("%d %d",&X,&Y)!=EOF){
		for (int i = 0; i < 4; i++)
			scanf("%d %d %d",&x[i],&y[i],&ph[i]);
		scanf("%d %lf",&L,&R);

		flag = false;

		for (int i = 0; i < 4; i++)
		{
			dis = sqrt((x[i]-X)*(x[i]-X)+(y[i]-Y)*(y[i]-Y));
			if (L>=dis)
			{
				dam = R * L;
				if (dam>=ph[i])
				{
					printf("Yes\n");
					flag = true;
					break;
				}
			}
		}
          
		if (!flag)
			printf("No\n");
	}
	return 0;
}
/*
Main.cc: In function 'int main(int, const char**)':
Main.cc:7:18: error: redeclaration of 'int x [4]'
  int X,Y,x[4],x[4],ph[4],L;
                  ^
Main.cc:7:10: note: 'int x [4]' previously declared here
  int X,Y,x[4],x[4],ph[4],L;
          ^
Main.cc:12:28: error: 'y' was not declared in this scope
    scanf("%d %d %d",&x[i],&y[i],&ph[i]);
                            ^
Main.cc:19:34: error: 'y' was not declared in this scope
    dis = sqrt((x[i]-X)*(x[i]-X)+(y[i]-Y)*(y[i]-Y));
                                  ^
*/

Double click to view unformatted code.


Back to problem 32