Friend or Foe?

2020年1月17日 949点热度 0人点赞 0条评论

Friend or Foe?

时间: 1ms        内存:128M

描述:

Luke has a bit of trouble telling the difference between star systems in the Rebel Alliance and those in the Empire. He has a list of the x,y,z coordinates of each system in the Empire and each in the Alliance, but at warp speed he simply has insufficient time to look up systems in his lists.

After destroying the friendly planet Endor, Luke has had to admit he needs the help of his targeting computer. His computer, being an early model, can only compute the truth value of the inequality

   ax + by + cz + d > 0

Where x,y,z are the coordinates of the system, and a,b,c,d are real-valued coefficients. You are to compute a,b,c,d so that the inequality holds for all systems in the Empire, and for no systems in the Alliance.

Input consists of several test cases followed by -1 -1. Each test case first gives the number of Alliance systems, followed by a line for each system giving the integer coordinates -100 ≤ x,y,z ≤ 100 of the system in 3-dimensional space. The number of Empire systems, and the coordinates of each, follow. The Empire and Alliance combined have at least one and no more than 200 systems. All systems have distinct coordinates.

For each test case, output a single line containing a,b,c,d as real numbers separated by spaces. Use enough precision to ensure that your solution is correct. You may assume that a solution exists; if there is more than one solution, any one will do.

输入:

输出:

示例输入:

2
-93 48 -92
-62 12 -32
8
51 98 -61
-3 72 81
95 25 22
89 43 -99
100 -2 -96
-18 45 -63
36 -21 -8
71 -24 42
-1 -1

示例输出:

83.000000 65.000000 -27.000000 -62.000000

提示:

参考答案:

解锁文章

没有看到答案?微信扫描二维码可免费解锁文章

微信扫描二维码解锁

使用微信扫描二维码打开广告页面后可以立即关闭,再刷新此页面即可正常浏览此文章

所跳转广告均由第三方提供,并不代表本站观点!

已经扫描此二维码?点此立即跳转

code

这个人很懒,什么都没留下

文章评论