joj 2575: Moveable quadrangle with three edges ()
来源:互联网 发布:音乐编辑软件手机版 编辑:程序博客网 时间:2024/05/18 00:01
我们知道,四边形是可以移动和不稳定的。给定三个相连的边a,b和c,它们之间的夹角可以活动,第四条边由两边的顶点虚拟连线构成,这个四边形的面积随不同的夹角变化。请找出最大的四边形面积。
Input
输入的每一行代表一个Case。每一行有三个正浮点数,分别是a,b,c。
Output
对于每一个输入,计算最大的四边形的面积。输入四舍五入到小数点后4位。
Sample Input
1 1 1.01 2 1.0
Sample Output
1.29902.2018
/*
利用几何关系找到当a b夹角固定时,c应当与ab边所成三角形垂直时,面积最大,所以只需枚举a b夹角就好(数据很水)。
*/
#include <cstdio>
#include <iostream>
#include <memory>
#include <cmath>
const int maxn = 1000;
const double pi=acos(-1.);
const double p=1e-5;
int main ()
{
double a,b,c;
while (scanf("%lf%lf%lf",&a,&b,&c)!=EOF)
{
double ans=0,r,tmp;
for ( r=p ; r<pi ; r=r+p)
{
double d=sqrt(a*a+b*b-2*a*b*cos(r));
tmp = a*b*sin(r)/2+d*c/2 ;
if(ans<tmp)ans=tmp;
}
printf("%.4lf/n",ans);
}
return 0;
}
- joj 2575: Moveable quadrangle with three edges ()
- 2575: Moveable quadrangle with three edges
- moveable layer
- [2_4_shortest_path_text] BFS => Shortest Path for Graphs with many Vertices buf few Edges
- geeksforgeeks Count all possible walks from a source to a destination with exactly k edges
- HDOJ 1236 with three methods using C++
- 马士兵动态代理Moveable
- HDU3694Fermat Point in Quadrangle
- UVa11455 - Behold my quadrangle
- Three
- three
- three
- three
- Threejs 官网 - Three.js 的图形用户界面工具(GUI Tools with Three.js)
- JOJ 2257
- joj 2319
- joj 2653
- JOJ 2687
- 带参数的main函数
- (一)设计包含min函数的栈
- 泛化、依赖、关联、聚合、组合
- 离散事件仿真
- 多线程编程之计算限制型异步操作(续)
- joj 2575: Moveable quadrangle with three edges ()
- 字符串类型处理实战
- iPhone开发重构:提取公用的方法以清理重复代码
- iPhone开发重构:提取方法以调整函数粒度
- iPhone开发重构:提取方法以调整抽象层次
- Joiner的用法
- ASP.NET中用IHttpModule接口实现伪静态
- 国产神器天语Android双核手机W700线下赏机经历
- HDU2273(点到线段距离)