http://acm.hdu.edu.cn/showproblem.php?pid=4386

题意:给四条边长,问能否组成四边形,如果能,求最大面积

求最大面积用海伦公式的四边形推广,p=(a+b+c+d)/2,S=sqrt((p-a)*(p-b)*(p-c)*(p-d))

#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <stack>
#include <set> using namespace std; int main(){
int T;
scanf("%d",&T);
for(int cas=;cas<=T;cas++){
int a[];
for(int i=;i<;i++)
scanf("%d",&a[i]);
sort(a,a+);
printf("Case %d: ",cas);
if(a[]<(a[]+a[]+a[])){
double p=(a[]+a[]+a[]+a[])/2.0;
printf("%.6lf\n",sqrt((p-a[])*(p-a[])*(p-a[])*(p-a[])));
}
else puts("-1");
}
return ;
}

最新文章

  1. Python 学习小结
  2. 开发android App干坏事(二)-wifi控制
  3. Cygwin的安装
  4. Oracle使用经验总结
  5. aws在线技术峰会笔记-电商解决方案
  6. Unity中启动VS时出现&quot;Visual Studio 2010 Shell 无效的许可证数据&quot;的解决办法
  7. Configuring the JA-SIG CAS Client --官方
  8. sql server备份相关
  9. 超市买苹果.py
  10. Task: Indoor Positioning with WiFi Signals
  11. 【译著】Code First :使用Entity. Framework编程(5)
  12. 解决Jupyter notebook[import tensorflow as tf]报错
  13. LwIP Application Developers Manual6---Application API layers
  14. php array_map与array_walk使用对比
  15. 图像分类(三)GoogLenet Inception_v3:Rethinking the Inception Architecture for Computer Vision
  16. 一个奇怪的SystemClock_Config问题解决方法
  17. linux命令学习(4):cd命令
  18. ASP.NET Web API 框架研究 Action的选择
  19. 镜像仓库管理:与Portus不得不说的那些事
  20. 浅谈svn的hook机制

热门文章

  1. MYSQL的三种注释
  2. [译]Quartz 框架 教程(中文版)2.2.x 之第一课 开始使用Quartz框架
  3. [原创]Keys的基本操作总结,判断Keys中是否存在Keys.Control|Keys.Alt,移除Keys中的部分键值。
  4. apache 访问权限基本设置
  5. 如何在datagridview 的head上绘制一个全选按钮
  6. 修改PE文件的入口函数OEP
  7. UVALive 5905 Pool Construction 最小割,s-t割性质 难度:3
  8. ubuntu连接Android调试
  9. 【第53套模拟题】【递推】【RMQ】【二进制】【分块】
  10. lastPathComponent的功能