首页 > 其他 > 详细

[CodeFights] Changu Circle

时间:2015-07-08 09:17:53      阅读:200      评论:0      收藏:0      [点我收藏+]

 Changu ,after his death reached hell and was given 3 numbers ( a , b , c ) of the form n^2+1 or m^2-1 or 2k ( s.t all 3 integers are of different forms for some integer n,m,k). He tries to make a triangle T using these 3 numbers as side lengths. Now he wants to calculate the minimum INTEGER radius r of a circle such that r is greater than or equal to the radius of circumcircle of the triangle T. Can you help him find this radius.

Note: Output should be -1 if no triangle can be formed using these lengths (a,b,c). Output -1 in case a triangle of zero area is being formed.

Constraints: -10^6<=a,b,c<=10^6

 

Input (a) → integer :
 
Input (b) → integer :
 
Input (c) → integer :
 
Output → integer :

The required radius r

 

这次是最短代码竞赛= =

然而我却只有第二TAT

1 int changu_circle(int a, int b, int c) {
2     return a+b+c<=2*(a=(a=a>b?a:b)>c?a:c)?-1:a/2+a%2;
3 }

 

[CodeFights] Changu Circle

原文:http://www.cnblogs.com/TonyNeal/p/codefights_changucircle.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!