zoukankan      html  css  js  c++  java
  • [CodeFights] Changu Circle

     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 }
  • 相关阅读:
    非常可乐
    Find The Multiple
    盲点集锦
    Fliptile
    Catch That Cow
    Dungeon Master
    hdoj 1045 Fire Net
    hdoj 1342 Lotto【dfs】
    zoj 2100 Seeding
    poj 3620 Avoid The Lakes【简单dfs】
  • 原文地址:https://www.cnblogs.com/TonyNeal/p/codefights_changucircle.html
Copyright © 2011-2022 走看看