码迷,mamicode.com
首页 > 其他好文 > 详细

杭赛.Triangle(数学推导)

时间:2015-03-28 20:10:15      阅读:131      评论:0      收藏:0      [点我收藏+]

标签:

Triangle

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

Problem Description
This is a simple question, give you a triangle, please divide the triangle into two parts with a segment. These two parts should have the same area, and the segment should be as short as possible. Please calculate the length of the segment.
 

 

Input
The first line of the input is the number T(T<=100), which is the number of cases followed. For each test case, the only line contains space-separated integers x1, y1, x2, y2, x3, y3,the coordinates of triangle endpoint. The absolute value of all the coordinates will not be more than 109.
 

 

Output
For each test case, output only one line, containing the length of segment only. Your answer should be rounded to 4 digits after the decimal point.
 

 

Sample Input
1 0 0 10 0 0 10
 

 

Sample Output
6.4359
 
最短分割线定理:
Z^2 = |a | * |b| - a * b

杭赛.Triangle(数学推导)

标签:

原文地址:http://www.cnblogs.com/get-an-AC-everyday/p/4374630.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!