This commit is contained in:
ljcjames 2022-08-22 23:17:19 +08:00
parent 2d30154beb
commit a951f5c478
5 changed files with 32 additions and 20 deletions

View File

@ -1,12 +1,16 @@
# 题目
* 链接
### 题意
如图求L
![](look)
### 做法
三分
mid=(l+r)/2;
midr(mid+r)/2;
远离峰值的收缩
### 关键词
三分
### 易错点
*
* 起始位置
### 工具箱
*

BIN
8.21/B-Light/look Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -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;
}

View File

@ -0,0 +1 @@
D

BIN
8.21/E-typewriter/E.pdf (Stored with Git LFS) Normal file

Binary file not shown.