ural 1874 Football Goal
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
const double eps=1e-; double getarea(double a,double b,double c)
{
double p=(a+b+c)/2.0;
return (c*c/+sqrt(p*(p-a)*(p-b)*(p-c)));
} int main()
{
double x,y;
scanf("%lf%lf",&x,&y);
double l=x+y,r=sqrt(x*x+y*y),s1;
while(fabs(r-l)>eps)
{
double mid1=(r+l)/;
double mid2=(mid1+l)/;
s1=getarea(x,y,mid1);
double s2=getarea(x,y,mid2);
if(s1>s2)
l=mid2;
else
r=mid1;
}
printf("%.9lf\n",s1);
return ;
}
ural 1874 Football Goal的更多相关文章
- 三分--Football Goal(面积最大)
B - Football Goal Time Limit:500MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Su ...
- 1874 football game(三分法and method to compute the area of trianngle)
FInd the max area. 1. 三分法 2. NAN (not comparable with number) http://acm.timus.ru/problem.aspx?space ...
- ural 2067. Friends and Berries
2067. Friends and Berries Time limit: 2.0 secondMemory limit: 64 MB There is a group of n children. ...
- ural 2063. Black and White
2063. Black and White Time limit: 1.0 secondMemory limit: 64 MB Let’s play a game. You are given a r ...
- UVA 10194 Football (aka Soccer)
Problem A: Football (aka Soccer) The Problem Football the most popular sport in the world (america ...
- HDU-1225 Football Score
http://acm.hdu.edu.cn/showproblem.php?pid=1225 一道超级简单的题,就因为我忘记写return,就wa好久,拜托我自己细心一点. 学习的地方:不过怎么查找字 ...
- Ural 1313 - Some Words about Sport
Ural doctors worry about the health of their youth very much. Special investigations showed that a l ...
- D - Football (aka Soccer)
Football the most popular sport in the world (americans insist to call it "Soccer", but we ...
- American Football Vocabulary!
American Football Vocabulary! Share Tweet Share You’ll learn all about the vocabulary of American fo ...
随机推荐
- SRM 584 DIV1
A 简单的差分约束模型 , 因为d是定值 , 所以也可以按最短路理解 , trick是不能把圈算进去. #define maxn 55 class Egalitarianism { public: i ...
- freemarker的使用心得
freemarker眼下尽管使用的公司不多,可是在某些时候就必须使用,当须要遍历json数据的时候,眼下市面上的好多显示组件都达不到要求唯一能用的也就仅仅有freemarker了.在java里使用的模 ...
- [Docker] Docker Client in Action
Pull the docker image: docker pull hello-world Show all the images: docker images Remove the image: ...
- CentOS 6.6下PXE+Kickstart无人值守安装操作系统
一.简介 1.1 什么是PXE PXE(Pre-boot Execution Environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持 ...
- 计算方法(二)用C#实现数值积分
在工程中,经常会遇到积分问题,这时原函数往往都是找不到的,因此就需要用计算方法的数值积分来求. public class Integral { /// <summary> /// 梯形公式 ...
- N!水题
//题目是求N!的问题,思路:设定一个整形数组来存放每次计算过后的值 有两个for循环,第一个for循环每次加进一个数 然后在第二个for循环里面计算出此时的阶乘,比如9999,先给出i=2 在第二个 ...
- Node.js脚本杀掉占用端口的进程
express默认端口为3000,由于实际需要改为3392,修改监听3392之后,没有成功,发现该端口被系统正占用,为了避免每次都手工停掉该系统调用,释放端口,故写了如下脚本. var cmd=pro ...
- spring aop例子
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAATcAAAFWCAIAAACD6E2aAAAgAElEQVR4nO2df1gTV77/55/93z/2ee
- js动态新增组合Input标签
var x = 1; function addlink() { var linkdiv = document.getElementById("add1_0"); if (linkd ...
- chrome Provisional headers are shown错误提示
1.一般出现这个错误是请求没有发送成功 可能原因:在上传文件或ajax上传时指定的timeout,过时时间小 其他资料: http://www.duanzhihe.com/575.html http: ...