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 }
  • 相关阅读:
    EF Load之详讲
    WPF系列 自定控件
    EF6 的性能优化
    WPF系列 Path表示语法详解(Path之Data属性语法)
    WPFTookit Chart 高级进阶
    WPFTookit Chart 入门
    WPF系列-CheckBox
    WPF系列 Style
    ASP.NET MVC 5 with EF 6 上传文件
    WPF Prism
  • 原文地址:https://www.cnblogs.com/TonyNeal/p/codefights_changucircle.html
Copyright © 2011-2022 走看看