#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <iostream>
using namespace std;
bool fun(double l1,double r1,double l2,double r2){
return (l1 <= r2 && l1 >= l2) || (l2 >= l1 && l2 <= r1);
}
int main() {
double a,b,c,d;
cin >> a >> b >> c >> d; double r = 1000000000.0;
double l = 0; for(int i = 0;i < 1000;i++){ double m = l + (r - l) /2.0;
double a1 = (a-m)*(d-m);
double a2 = (a-m)*(d+m);
double a3 = (a+m)*(d-m);
double a4 = (a+m)*(d+m);
double l1 = min(min(a1,a2),min(a3,a4));
double r1 = max(max(a1,a2),max(a3,a4));
a1 = (c-m)*(b-m);
a2 = (c-m)*(b+m);
a3 = (c+m)*(b-m);
a4 = (c+m)*(b+m);
double l2 = min(min(a1,a2),min(a3,a4));
double r2 = max(max(a1,a2),max(a3,a4));
if(fun(l1,r1,l2,r2)){
r = m;
}
else{
l = m;
}
}
printf("%.10f\n",l);
return 0; }

codeforces Looksery Cup 2015 H Degenerate Matrix 二分 注意浮点数陷阱的更多相关文章

  1. codeforces Looksery Cup 2015 H Degenerate Matrix

    The determinant of a matrix 2 × 2 is defined as follows: A matrix is called degenerate if its determ ...

  2. Looksery Cup 2015 H. Degenerate Matrix 数学

    H. Degenerate Matrix Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/549/ ...

  3. codeforces Looksery Cup 2015 D. Haar Features

    The first algorithm for detecting a face on the image working in realtime was developed by Paul Viol ...

  4. codeforces Looksery Cup 2015 C. The Game Of Parity

    There are n cities in Westeros. The i-th city is inhabited by ai people. Daenerys and Stannis play t ...

  5. Codeforces 549H. Degenerate Matrix 二分

    二分绝对值,推断是否存在对应的矩阵 H. Degenerate Matrix time limit per test 1 second memory limit per test 256 megaby ...

  6. Looksery Cup 2015 Editorial

    下面是题解,做的不好.下一步的目标是rating涨到 1800,没打过几次cf A. Face Detection Author: Monyura One should iterate through ...

  7. Codeforces VK CUP 2015 D. Closest Equals(线段树+扫描线)

    题目链接:http://codeforces.com/contest/522/problem/D 题目大意:  给你一个长度为n的序列,然后有m次查询,每次查询输入一个区间[li,lj],对于每一个查 ...

  8. Looksery Cup 2015 A. Face Detection 水题

    A. Face Detection Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/549/pro ...

  9. Looksery Cup 2015 B. Looksery Party 暴力

    B. Looksery Party Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/549/pro ...

随机推荐

  1. Web前端开发实战2:二级下拉式菜单之JS实现

    上一篇博文提到了二级下拉式菜单是用HTML和CSS实现的.我们这一篇来用JavaScript脚本实现下拉菜单的显 示和隐藏. 使用 JavaScript方法实现我们须要用的知识有: 1)JS事件:on ...

  2. android优化 清除无效代码 UCDetector

    android下优化 清除无效 未被使用的 代码 UCDetector 官方下载地址:http://www.ucdetector.org/index.html UCDetector  是 eclips ...

  3. android继续探索Fresco

    我们接着上文继续说,上篇博客中我们已经知道了Fresco怎么用,也知道了它的非常多属性.可是非常多时候xml文件是不能满足你的要求的.这就须要你在代码中动态的改变显示的内容,今天我们就来探索一下怎样在 ...

  4. OpenST Basic tool library

    /***************************************************************************** * OpenST Basic tool l ...

  5. Visual studio 编译时copy文件、文件夹

    项目属性--生成事件 添加命令 xcopy /y /d "$(SolutionDir)Dll\Linphone\*.dll" "$(TargetDir)\Linphone ...

  6. 0x18 总结与练习

    这一章不太满意啊.. 还是有点痛苦,但就是做的挺慢啊... 1.就是例题 2.括号画家 感觉这种提高组类型的细节题都没什么信心啊,fail了几次才A #include<cstdio> #i ...

  7. iis browse的时候,直接通过本地的局域网ip打开页面

    http://www.codepal.co.uk/show/make_IIS_work_with_local_IP_addresses_instead_of_localhost 只需要设置一下webs ...

  8. php常用知识集锦

    php常用知识集锦 很多位置都有写好的代码,自己做项目的时候可以直接拿来用,而不用自己写,比如现在看到的菜鸟教程. 1.判断是否为空 empty($_POST["name"]) 2 ...

  9. BigInteger类型转换成Long类型或int类型问题

            BigInteger bi = new BigInteger("123");           int i = bi.intValue();         lo ...

  10. 6 ZigZig Conversion[M]Z字形变换

    题目 The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows li ...