#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. CountDownLatch使用方法

    CountDownLatch是一个同步辅助类,在完毕一组正在其它线程中运行的操作之前.它同意一个或多个线程一直等待. 如果我们周末要去旅游.出游前须要提前订好机票.巴士和酒店,都订好后就能够出发了.这 ...

  2. Android 进程常驻(5)----开机广播的简单守护以及总结

    这是一个轻量级的库,配置几行代码.就能够实如今android上实现进程常驻,也就是在系统强杀下,以及360获取root权限下.clean master获取root权限下都无法杀死进程 支持系统2.3到 ...

  3. c 语言函数可变參数的处理

    /************************************************************************* > File Name: va_list.c ...

  4. sql server 数据库展开变慢

    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/99bbcb47-d4b5-4ec0-9e91-b1a23a655844/ssms-2 ...

  5. Spark Streaming概念学习系列之SparkStreaming运行原理

    SparkStreaming运行原理 Spark Streaming不断的从数据源获取数据(连续的数据流),并将这些数据按照周期划分为batch. Spark Streaming将每个batch的数据 ...

  6. layer Tips参数使用

    layer.tips(content, follow, options) - tips层type:4的深度定制.也是我本人比较喜欢的一个层类型,因为它拥有和msg一样的低调和自觉,而且会智能定位,即灵 ...

  7. js滑动提示效果

    js代码 漂亮的动画效果:在靠右上角:背景颜色为红,字体颜色为白色  滑动 变大 上移  缓慢渐变消失 function tishi() { $("#tishi").attr(&q ...

  8. 构建工具系列一--Travis-cli

    本文地址: http://www.cnblogs.com/blackmanba/articles/continuous-integration-tool-travis-cli.html或者http:/ ...

  9. OpenCV3 安装

    Opencv 安装 本文主要说明了在ubuntu上通过源码安装Opencv3,包含各种独立接口.具体可以参照LearnOpencv: https://www.learnopencv.com/insta ...

  10. hdu 3549 Flow Problem 【最大流】

    其实还是不是很懂dinic----- 抄了一个模板--- http://www.cnblogs.com/naturepengchen/articles/4403408.html 先放在这里--- #i ...