This commit is contained in:
parent
2d30154beb
commit
a951f5c478
|
@ -1,12 +1,16 @@
|
|||
# 题目
|
||||
* 链接
|
||||
### 题意
|
||||
|
||||
如图,求L
|
||||
![](look)
|
||||
### 做法
|
||||
|
||||
三分
|
||||
mid=(l+r)/2;
|
||||
midr(mid+r)/2;
|
||||
远离峰值的收缩
|
||||
### 关键词
|
||||
|
||||
三分
|
||||
### 易错点
|
||||
*
|
||||
* 起始位置
|
||||
### 工具箱
|
||||
*
|
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
|
@ -3,29 +3,33 @@
|
|||
#include<algorithm>
|
||||
#include <cmath>
|
||||
using namespace std;
|
||||
//const int N=1e8+5;
|
||||
//void initialise(int n)
|
||||
//{
|
||||
//
|
||||
//}
|
||||
const double eps= 1e-5;
|
||||
double H,h,D;
|
||||
double f(double d)
|
||||
{
|
||||
return D-d+H-(H-h)*D/d;
|
||||
// return D-d+h-(H-h)*(D-d)/d;
|
||||
}
|
||||
double sanfen(double l,double r)
|
||||
{
|
||||
double mid,midr,ans;
|
||||
while(fabs(r-l)>eps)
|
||||
{
|
||||
mid=(l+r)/2;
|
||||
midr=(mid+r)/2;
|
||||
if(f(mid)<f(midr))l=mid;
|
||||
else r=midr;
|
||||
}
|
||||
return f(l);
|
||||
}
|
||||
int main()
|
||||
{
|
||||
int t;
|
||||
double H,h,D;
|
||||
scanf("%d",&t);
|
||||
while(t--)
|
||||
{
|
||||
scanf("%lf%lf%lf",&H,&h,&D);
|
||||
// initialise(n);
|
||||
double add=D/2-(H-h);
|
||||
if(add>0)
|
||||
{
|
||||
printf("%.3lf\n",h+add);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("%.3lf\n",h);
|
||||
}
|
||||
printf("%.3lf\n",sanfen(D-D*h/H,D));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
D
|
Binary file not shown.
Loading…
Reference in New Issue