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<algorithm>
#include <cmath> #include <cmath>
using namespace std; using namespace std;
//const int N=1e8+5; const double eps= 1e-5;
//void initialise(int n) 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 main()
{ {
int t; int t;
double H,h,D;
scanf("%d",&t); scanf("%d",&t);
while(t--) while(t--)
{ {
scanf("%lf%lf%lf",&H,&h,&D); scanf("%lf%lf%lf",&H,&h,&D);
// initialise(n); printf("%.3lf\n",sanfen(D-D*h/H,D));
double add=D/2-(H-h);
if(add>0)
{
printf("%.3lf\n",h+add);
}
else
{
printf("%.3lf\n",h);
}
} }
return 0; 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.