zoukankan      html  css  js  c++  java
  • HDU 4386 Quadrilateral [最大四边形面积]

      之前无聊时还想到过这个东西,没想到多校就出出来了。。

      结论是面积最大时正好是圆的内接四边形,证明网上可以找到。。

     1 #include <stdio.h>
     2 #include <math.h>
     3 #include <algorithm>
     4 double l[4];
     5 int cas;
     6 double hl(){
     7     double p=(l[0]+l[1]+l[2]+l[3]) / 2;
     8     return sqrt((p-l[0])*(p-l[1])*(p-l[2])*(p-l[3]));
     9 }
    10 int main(){
    11     scanf("%d", &cas);
    12     for (int ca = 1; ca <= cas; ca++) {
    13         scanf("%lf%lf%lf%lf", &l[0], &l[1], &l[2], &l[3]);
    14         std::sort(l, l+4);
    15         if(l[3] >= l[0]+l[1]+l[2])printf("Case %d: -1\n", ca);
    16         else printf("Case %d: %.6f\n", ca , hl());
    17     }
    18     return 0;
    19 }
  • 相关阅读:
    Access-自定义控件TabControl
    Excel公式-求最低价网站名字
    Excel图表-太极图
    Excel图表-"DNA"图
    VB中的GDI编程-2 画笔
    leetcode
    leetcode
    leetcode
    leetcode
    leetcode
  • 原文地址:https://www.cnblogs.com/swm8023/p/2711266.html
Copyright © 2011-2022 走看看