hdu6206 Apple 2017 ACM/ICPC Asia Regional Qingdao Online

Posted weeping

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了hdu6206 Apple 2017 ACM/ICPC Asia Regional Qingdao Online相关的知识,希望对你有一定的参考价值。

地址:http://acm.split.hdu.edu.cn/showproblem.php?pid=6206

题目:

Apple

Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)
Total Submission(s): 530    Accepted Submission(s): 172


Problem Description
Apple is Taotao\'s favourite fruit. In his backyard, there are three apple trees with coordinates (x1,y1)(x2,y2), and (x3,y3). Now Taotao is planning to plant a new one, but he is not willing to take these trees too close. He believes that the new apple tree should be outside the circle which the three apple trees that already exist is on. Taotao picked a potential position (x,y) of the new tree. Could you tell him if it is outside the circle or not?
 

 

Input
The first line contains an integer T, indicating that there are T(T30) cases.
In the first line of each case, there are eight integers x1,y1,x2,y2,x3,y3,x,y, as described above.
The absolute values of integers in input are less than or equal to 1,000,000,000,000.
It is guaranteed that, any three of the four positions do not lie on a straight line.
 

 

Output
For each case, output "Accepted" if the position is outside the circle, or "Rejected" if the position is on or inside the circle.
 

 

Sample Input
3 -2 0 0 -2 2 0 2 -2 -2 0 0 -2 2 0 0 2 -2 0 0 -2 2 0 1 1
 

 

Sample Output
Accepted Rejected Rejected
 

 

Source
 
思路:
  这题关键是找圆心,如果圆心知道了,后面的都好做了。
  圆心坐标公式,来自维基:
  

  这题精度要求高,直接用double or long double都会挂。

  做法有俩个:

  1.保留除法运算,那就只能用java的BigDecimal(好像叫这个)

  2.进行公式化简:

  

  所以这时只需要比较分子就好了,只需要大数模板。

  然而我知道怎么做还是wa一下午,依旧没过,不会java,用c++的大数模板写又写挂了。。。gg,心痛。

  这题还可以圆的反演做。

  没有代码贴了。

  

以上是关于hdu6206 Apple 2017 ACM/ICPC Asia Regional Qingdao Online的主要内容,如果未能解决你的问题,请参考以下文章

hdu6206 Apple java,三点找外接圆

HDU 6206 Apple ( 高精度 && 计算几何 && 三点构圆求圆心半径 )

poj 6206 Apple

HDU 1565&1569 方格取数系列(状压DP或者最大流)

Apple - Hdu5160

HDU 4925 Apple Tree (瞎搞)