呵呵呵......................................
感觉受到了一千万点的伤害.........就这几句话......第三条......开始以为是在一个格子里......后来根据样例觉得还是在哪个点上.....再后来debug一个点.....
尼玛....原来的距离是比1小....累觉不爱....人艰不拆.....
好烦...比赛的时候为什么没有看出来是这个呢...
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
1 #include<stdio.h> 2 #include<string.h> 3 #include<map> 4 #include<vector> 5 #include<iostream> 6 #include<math.h> 7 using namespace std; 8 9 int main() 10 { 11 double dis, st, ed; 12 int cnt = 0; 13 while(~scanf("%lf%lf%lf", &dis, &st, &ed)) 14 { 15 if (dis == 0) break; 16 int x, y; 17 bool flag = true; 18 int fx, fy; 19 while(scanf("%d%d", &x, &y)) 20 { 21 if (x == -1 && y == -1) 22 break; 23 if (flag == false) continue; 24 fx = x; 25 fy = y; 26 double tx, ty; 27 if (x != st) 28 { 29 double k = (y-ed) * 1.0 / (x-st); 30 if (k < 0) k = -k; 31 double ang = atan(k); 32 tx = dis*cos(ang); 33 ty = dis*sin(ang); 34 } 35 else if (x == st) 36 { 37 tx = 0; 38 ty = dis; 39 } 40 double yy = (y-ed)*(y-ed); 41 double xx = (x-st)*(x-st); 42 double dd = sqrt((yy+xx)); 43 44 if (dd <= dis + 1) 45 { 46 flag = false; 47 continue; 48 } 49 if (x >= st) st += tx; 50 else st -= tx; 51 if (y >= ed) ed += ty; 52 else ed -= ty; 53 if (st < 0) st = 0; 54 if (ed < 0) ed = 0; 55 } 56 if (flag) printf("Firefly %d not caught\n", ++cnt); 57 else printf("Firefly %d caught at (%d,%d)\n", ++cnt, fx, fy); 58 } 59 return 0; 60 }