HDU 1700 (几何问题)

 Points on Cycle

Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 513    Accepted Submission(s): 195

Problem Description
There is a cycle with its center on the origin.
Now give you a point on the cycle, you are to find out the other two points on it, to maximize the sum of the distance between each other
you may assume that the radius of the cycle will not exceed 1000.
 

 

Input
There are T test cases, in each case there are 2 decimal number representing the coordinate of the given point.
 

 

Output
For each testcase you are supposed to output the coordinates of both of the unknow points by 3 decimal places of precision
Alway output the lower one first(with a smaller Y-coordinate value), if they have the same Y value output the one with a smaller X.

NOTE
when output, if the absolute difference between the coordinate values X1 and X2 is smaller than 0.0005, we assume they are equal.
 

 

Sample Input
  
  
2 1.500 2.000 563.585 1.251
 

 

Sample Output
0.982 -2.299 -2.482 0.299
-280.709 -488.704 -282.876 487.453
 
题意:一个以原点为中心的圆,告诉你圆上的一个点,求与另外的两个点组成的三角形的周长最长的两点作标。
根据几何知识,知道圆内等边三角形的周长最长。所以题目转化为求已知一个点的圆内接等边三角形的另两点作标。
思路:设P(x,y),一个方程是pow(x,2)+pow(y,2)=pow(r,2);另一个方程是根据向量知识,向量的夹角公式得到方程。
因为圆心角夹角为120度,已知一个向量(即一个点作标),所以COS(2PI/3)=a*b/|a|*|b|;(a,b为向量);
已知角和a向量,就可求b向量b(x,y).由方程组可求得(x,y);最后得到的是一元二次方程组,可得到两个解,即为两个点的作标。
代码如下:
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值