2575: Moveable quadrangle with three edges

来源:互联网 发布:js回调函数是什么意思 编辑:程序博客网 时间:2024/06/06 00:32

2575: Moveable quadrangle with three edges


StatusIn/OutTIME LimitMEMORY LimitSubmit TimesSolved UsersJUDGE TYPEstdin/stdout3s8192K37763Standard

我们知道,四边形是可以移动和不稳定的。给定三个相连的边a,b和c,它们之间的夹角可以活动,第四条边由两边的顶点虚拟连线构成,这个四边形的面积随不同的夹角变化。请找出最大的四边形面积。

Input

输入的每一行代表一个Case。每一行有三个正浮点数,分别是a,b,c。

Output

对于每一个输入,计算最大的四边形的面积。输入四舍五入到小数点后4位。

Sample Input

1 1 1.01 2 1.0

Sample Output

1.29902.2018数学几何的题目一定要学会划分,接着用各种怪异的方法写出来。
附上ZZC大牛的代码,这是他第一次的代码
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
const double PI = acos(-1.);
int main(void)
{
 double a, b, c;
 while(scanf("%lf%lf%lf", &a, &b, &c) != EOF)
 {
  double p = 1e-5;
  double area = 0, tmp;
  for(double radius = 0; radius <= PI; radius += p)
  {
   double d = sqrt(a * a + b * b - 2 * a * b * cos(radius));
   tmp = a * b * sin(radius) / 2 + d * c / 2;
   if(tmp > area)
    area = tmp;
  }
  printf("%lf",PI);
  printf("%.4lf/n", area);
 }
 return 0;
}