#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,K; 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++) { K = double(dota[i].x - x0)*(dota[i].x - x0) + (dota[i].y - y0)*(dota[i].y - y0); if (K <= R*R) if (sqrt(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:8: error: expected expression before 'double' K = double(dota[i].x - x0)*(dota[i].x - x0) + (dota[i].y - y0)*(dota[i].y - y0); ^ */ |
Double click to view unformatted code.