View Code of Problem 32

#include<stdio.h>
#include<math.h>
typedef struct 
{
	int x;
	int y;
	int hp;
}Dota;

int main()
{
	int x0, y0, L,flag=0;
	double R;
	Dota dota[5];
	while (scanf("%d%d", &x0, &y0) != EOF)
	{
		flag = 0;
		for (int i = 0; i < 5; i++)
		{
			scanf("%d %d %d", &dota[i].x, &dota[i].y, &dota[i].hp);
		}
		scanf("%d %lf", &L, &R);
		for (int i = 0; i < 5; i++)
		{
			double k = pow(double(dota[i].x - x0), 2) + pow(double(dota[i].y - y0), 2);
			if (k <= pow(double(L), 2))
				if (k*R - dota[i].hp >= 0)
				{
					printf("YES\n");
					flag = 1;
					break;
				}
		}
		if (flag == 0)
			printf("NO\n");

	}
}
/*
Main.c: In function 'main':
Main.c:25:19: error: expected expression before 'double'
    double k = pow(double(dota[i].x - x0), 2) + pow(double(dota[i].y - y0), 2);
                   ^
Main.c:25:15: error: too few arguments to function 'pow'
    double k = pow(double(dota[i].x - x0), 2) + pow(double(dota[i].y - y0), 2);
               ^
Main.c:25:52: error: expected expression before 'double'
    double k = pow(double(dota[i].x - x0), 2) + pow(double(dota[i].y - y0), 2);
                                                    ^
Main.c:25:48: error: too few arguments to function 'pow'
    double k = pow(double(dota[i].x - x0), 2) + pow(double(dota[i].y - y0), 2);
                                                ^
Main.c:26:17: error: expected expression before 'double'
    if (k <= pow(double(L), 2))
                 ^
Main.c:26:13: error: too few arguments to function 'pow'
    if (k <= pow(double(L), 2))
             ^
*/

Double click to view unformatted code.


Back to problem 32