hdu6206 Apple 2017 ACM/ICPC Asia Regional Qingdao Online
阿新 • • 發佈:2017-09-18
href long dao nat cep 公式 ane left ref , (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?
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.
地址: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
Input The first line contains an integer T, indicating that there are T(T≤30) 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 2017 ACM/ICPC Asia Regional Qingdao Online 思路: 這題關鍵是找圓心,如果圓心知道了,後面的都好做了。 圓心坐標公式,來自維基:
這題精度要求高,直接用double or long double都會掛。
做法有倆個:
1.保留除法運算,那就只能用java的BigDecimal(好像叫這個)
2.進行公式化簡:
所以這時只需要比較分子就好了,只需要大數模板。
然而我知道怎麽做還是wa一下午,依舊沒過,不會java,用c++的大數模板寫又寫掛了。。。gg,心痛。
這題還可以圓的反演做。
沒有代碼貼了。
hdu6206 Apple 2017 ACM/ICPC Asia Regional Qingdao Online