题意:人左右走动,求影子L的最长长度。

思路:三分人在D上的位置。注意影子长=D-x+H-(H-h)*D/x。

 #include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<memory.h>
#include<string.h>
#include<algorithm>
#include<cmath>
#define clc(a,b) memset(a,b,sizeof(a))
typedef long double ld;
typedef long long ll;
const int N = ;
const double eps=1e-;
const int inf=-;
const int maxn=1e5+;
const double Pi=acos(-);
using namespace std; double H,h,D; double calc(double x)
{
return D-x+H-(H-h)*D/x;
} double solve(double l,double r)
{
//cout<<"11"<<endl;
double mid,midmid;
double d1,d2;
while(r-l>=eps)
{
mid=(l+r)/;
midmid=(mid+r)/;
d1=calc(mid);
d2=calc(midmid);
if(d1>=d2)
r=midmid;
else
l=mid;
}
return d1;
} int main()
{
int t;
scanf("%d",&t);
while(t--)
{
scanf("%lf%lf%lf",&H,&h,&D);
printf("%.3lf\n",solve((H-h)*D/H,D));
}
return ;
}

ZOJ Light Bulb - 3203的更多相关文章

  1. ZOJ 3203 Light Bulb (三分+计算几何)

    B - Light Bulb Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit ...

  2. 三分 --- ZOJ 3203 Light Bulb

    Light Bulb Problem's Link:   http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3203 Mean: ...

  3. ZOJ 3203 Light Bulb - 求导求最大值

    如果L全在地面上: 输出 h * D / H 如果L全在墙上: 输出 h 否则: (D - X ) / X = Y / (H - h) L = D - X + h - Y 然后对L求导即可 #incl ...

  4. zoj 3203 Light Bulb,三分之二的基本问题

    Light Bulb Time Limit: 1 Second      Memory Limit: 32768 KB Compared to wildleopard's wealthiness, h ...

  5. ZOJ 3203 Light Bulb (三分查找)

    Light Bulb Time Limit: 1 Second      Memory Limit: 32768 KB Compared to wildleopard's wealthiness, h ...

  6. ZOJ 3203 Light Bulb

    Compared to wildleopard's wealthiness, his brother mildleopard is rather poor. His house is narrow a ...

  7. ZOJ 3203 Light Bulb(数学对勾函数)

    Light Bulb Time Limit: 1 Second      Memory Limit: 32768 KB Compared to wildleopard's wealthiness, h ...

  8. [清华集训2015]灯泡(浙江大学ZOJ 3203 Light Bulb)

    Time Limit: 1 Second      Memory Limit: 32768 KB Compared to wildleopard's wealthiness, his brother ...

  9. Light Bulb(三分)

    ZOJ Problem Set - 3203 Light Bulb Time Limit: 1 Second      Memory Limit: 32768 KB Compared to wildl ...

随机推荐

  1. CF 136B Ternary Logic

    http://codeforces.com/problemset/problem/136/B 题意 :就是说tor是一个三进制的运算,代表的是两个三进制数的运算,两个三进制数按位逐一相加后对三取余,没 ...

  2. python-append()方法

    append() 方法向列表的尾部添加一个新的元素.只接受一个参数. >>> mylist = [1,2,3,4] >>> mylist [1, 2, 3, 4] ...

  3. 转:Bitbucket使用方法

    一.软件及SSH keys: 由于我的Bitbucket账号的邮箱及用户名与Github相同,所以SSH Public Keys可以用Github的,登录Bitbucket,悬浮在用户名boliqua ...

  4. C#中this在构造函数时的使用

    今天编程的时候,想要用this来处理构造函数,想了半天没有想起来 后来找了自己以前记录的 http://www.cnblogs.com/chucklu/p/4842766.html public Cu ...

  5. poj 1129 Channel Allocation ( dfs )

    题目:http://poj.org/problem?id=1129 题意:求最小m,使平面图能染成m色,相邻两块不同色由四色定理可知顶点最多需要4种颜色即可.我们于是从1开始试到3即可. #inclu ...

  6. Java中的protected访问修饰符

    在某个类中定义的protected 方法和属性和默认权限方法和属性是一样的.比如,某类的protected 方法和属性在包外是不能通过该类实例进行访问的(你能在包外访问一个类的默认权限的方法和属性吗? ...

  7. 结构体UT_LIST_ADD_LAST

    使用 UT_LIST_ADD_LAST(list, buf_pool->free, (&block->page)); /****************************** ...

  8. 函数 buf_block_init

    /********************************************************************//** Initializes a buffer contr ...

  9. BZOJ3232: 圈地游戏

    题解: 神题一道... 题解戳这里:http://hi.baidu.com/strongoier/item/0425f0e5814e010265db0095 分数规划可以看这里:http://blog ...

  10. [Mac][phpMyAdmin] [2002] No such file or directory

    我从phpMyAdmin的官网下载了最新版,将它解压到 /Library/WebServer/Documents 下,然后把文件夹改名 phpmyadmin . 接着输入在浏览器中输入 localho ...