给定四个边,求所构成的四边形的最大面积用海伦公式

While working a night shift at the university as a janitor, you absentmindedly erase a blackboard covered with equations, only to realize afterwards that these were no ordinary equations! They were the notes of the venerable Professor E. I. N. Stein who earlier in the day solved the elusive maximum quadrilateral problem! Quick, you have to redo his work so no one noticed what happened.

The maximum quadrilateral problem is quite easy to state: given four side lengths s1,s2,s3s1,s2,s3 and s4s4, find the maximum area of any quadrilateral that can be constructed using these lengths. A quadrilateral is a polygon with four vertices.

Input

The input consists of a single line with four positive integers, the four side lengths s1s1, s2s2, s3s3, and s4s4.

It is guaranteed that 2si<∑4j=1sj2si<∑j=14sj, for all ii, and that 1≤si≤10001≤si≤1000.

Output

Output a single real number, the maximal area as described above. Your answer must be accurate to an absolute or relative error of at most 10−610−6.

#include<bits/stdc++.h>
using namespace std;
int main()
{double a,b,c,d;scanf("%lf%lf%lf%lf",&a,&b,&c,&d);double p=(a+b+c+d)/2;printf("%.15f\n",sqrt((p-a)*(p-b)*(p-c)*(p-d)));return 0;
}

Janitor Troubles相关推荐

  1. J - Janitor Troubles 三分 海伦公式

    交题链接 解法: (1) 利用三分查找两边角度,求出围成最大面积的那个角度 此处用角度求面积方法:余弦公式   得到对角线C边长度 再用海伦公式可分别求出两个三角形面积,然后相加为四边形面积 #inc ...

  2. CCSU training contest(2)

    linklinklink j Janitor Troubles 给你四边形四条边,求能组成的四边形面积的最大值 如果,给了三条边,那么组成的三角形就是确定的,面积是定值,我们可以根据海伦公式求出来. ...

  3. 【题解】284E. Coin Troubles(dp+图论建模)

    [题解]284E. Coin Troubles(dp+图论建模) 题意就是要你跑一个完全背包,但是要求背包的方案中有个数相对大小的限制 考虑一个\(c_i<c_j\)的限制,就是一个\(c_i\ ...

  4. Video Game Troubles(有依赖的背包)

    链接:https://ac.nowcoder.com/acm/contest/1077/B 来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言6553 ...

  5. Hanoi Tower Troubles Again!

    题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1239 题目描述: Time Limit: 2 Seconds   ...

  6. codeforces gym101482 J Judging Troubles 暴力+map

    https://vjudge.net/problem/Gym-101482J 题目大意:给出两个判题系统的判题结果,问最多能还原多少情况. 思路:搞两个mapmapmap分别存一下,然后遍历第一个ma ...

  7. codeforces 283C Coin Troubles(背包DP)

    题目链接:http://codeforces.com/problemset/problem/283/C 题意:给定n件物品以及每件的重量(每种物品无限多).已知选取了一些物品的总重量为m,(x1,x2 ...

  8. 【洛谷P2967】【USACO 2009 Dec】电子游戏 Video Game Troubles

    问题描述 约翰的奶牛们玩游戏成瘾!本来约翰是想把她们拖去电击治疗的,后来他发现奶牛们在生产了更多的牛奶,也就开始支持她们了. 但是,奶牛在选择游戏平台上的分歧很大:有的奶牛想买一台 Xbox 360来 ...

  9. UVALive 6678 Judging Troubles

    题意是:给你一组数组,求出存在多少个区间,满足区间内的数的xor值和and值是相等的. 我的想法是:先枚举区间左端点(假设为第 L 行),由于and的特性,从L开始,可以将[L,n)划分成32段,从L ...

最新文章

  1. Python:数据提取之JSON与JsonPATH
  2. Linux那些事儿 之 戏说USB(25)设备的生命线(八)
  3. windows上搭建python+gvim开发环境
  4. 分析和解密已加密的路由器固件
  5. ALV标准的分类小计功能
  6. 关于nunit调试VS2010中的4.0程序集的问题
  7. c++向量和数组的区别_Matlab入门基础知识(5)对数组的操作
  8. 5个节点hadoop安装(zookeeper)
  9. 2种造成sqlserver自增列不连续的原因
  10. 百亿级日访问量的应用如何做缓存架构设计?
  11. 《JavaScript高级程序设计》阅读笔记(十五):浏览器中的JavaScript
  12. 全栈项目-乐优商场-通用工具服务-通用异常处理
  13. main函数写法总结
  14. Openbravo怎么给工具栏添加一个按钮
  15. 华为服务器控制口地址修改,服务器修改管理口地址
  16. Win10家庭版没有权限访问网上邻居,不能连接共享打印机的解决办法
  17. 7-65 平面向量加法 (15分)
  18. 小米云备份的正确打开方式,你学会了吗
  19. 网络命令(ARP、PING)的使用分析
  20. 8年老码农现身说法:大龄程序员找工作,为什么这么难?

热门文章

  1. uniapp px转rpx
  2. 重启计算机指令没用,win10笔记本不能关机重启点什么都没反应怎么办
  3. Error: ADB exited with exit code 1 Performing Streamed Install adb: failed to install D:\svn\app\sm
  4. js事件冒泡和传播详细解释
  5. 只用html如何实现音乐播放,如何使用html实现音乐播放
  6. 炫酷的 loding效果(canvas)
  7. python之shapely库的使用
  8. hdu4771 Stealing Harry Potter's Precious (状压+bfs)
  9. Java英语单词大全
  10. 『 文件操作 』文件批量改名