HDU 4386
2024-08-28 20:51:50
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 ;
}
最新文章
- Python 学习小结
- 开发android App干坏事(二)-wifi控制
- Cygwin的安装
- Oracle使用经验总结
- aws在线技术峰会笔记-电商解决方案
- Unity中启动VS时出现";Visual Studio 2010 Shell 无效的许可证数据";的解决办法
- Configuring the JA-SIG CAS Client --官方
- sql server备份相关
- 超市买苹果.py
- Task: Indoor Positioning with WiFi Signals
- 【译著】Code First :使用Entity. Framework编程(5)
- 解决Jupyter notebook[import tensorflow as tf]报错
- LwIP Application Developers Manual6---Application API layers
- php array_map与array_walk使用对比
- 图像分类(三)GoogLenet Inception_v3:Rethinking the Inception Architecture for Computer Vision
- 一个奇怪的SystemClock_Config问题解决方法
- linux命令学习(4):cd命令
- ASP.NET Web API 框架研究 Action的选择
- 镜像仓库管理:与Portus不得不说的那些事
- 浅谈svn的hook机制
热门文章
- MYSQL的三种注释
- [译]Quartz 框架 教程(中文版)2.2.x 之第一课 开始使用Quartz框架
- [原创]Keys的基本操作总结,判断Keys中是否存在Keys.Control|Keys.Alt,移除Keys中的部分键值。
- apache 访问权限基本设置
- 如何在datagridview 的head上绘制一个全选按钮
- 修改PE文件的入口函数OEP
- UVALive 5905 Pool Construction 最小割,s-t割性质 难度:3
- ubuntu连接Android调试
- 【第53套模拟题】【递推】【RMQ】【二进制】【分块】
- lastPathComponent的功能