2024-08-17 18:25:09
发布于:广东
全部评论 3
#include<cmath>
#include<queue>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef double dl;
const int N=510;
const dl eps=1e-8;
struct cir{
dl x,r;
}p[N];
struct line{
dl k,b,l,r;
}q[N];
int n;
dl alpha;
inline dl py(dl a,dl b){return sqrt(aa-bb);}
inline dl f(dl x){
dl ans=0;
for(int i=1;i<=n;i++){
if(p[i].x-p[i].r<x&&x<p[i].x+p[i].r){
ans=max(ans,py(p[i].r,x-p[i].x));
}
}
for(int i=1;i<n;i++){
if(q[i].l<=x&&x<=q[i].r){
ans=max(ans,q[i].kx+q[i].b);
}
}
return ans;
}
inline dl simpson(dl l,dl r){
dl mid=(l+r)/2;
return (f(l)+4f(mid)+f(r))(r-l)/6;
}
inline dl asr(dl l,dl r,dl ans){
dl mid=(l+r)/2;
dl l1=simpson(l,mid),r1=simpson(mid,r);
if(fabs(l1+r1-ans)<eps)return l1+r1;
return asr(l,mid,l1)+asr(mid,r,r1);
}
inline int shadow(dl a){
dl c=aalpha;
dl d=sqrt(aa+cc);
return ca/d;
}
inline void getl(int x,int y){
if(fabs(p[x].r-p[y].r)<eps){
q[x].l=p[x].x,q[x].r=p[y].x;
q[x].k=0;q[x].b=p[x].r;
return;
}
dl CA=p[y].x-p[x].x,AJ=fabs(p[x].r-p[y].r);
dl CG=p[x].r,AB=p[y].r;
dl CK=CGAJ/CA,AI=ABAJ/CA;
if(p[x].r>p[y].r){
q[x].l=p[x].x+CK;q[x].r=p[y].x+AI;
dl x1=q[x].l,y1=py(CG,CK);
dl x2=q[x].r,y2=py(AB,AI);
q[x].k=(y1-y2)/(x1-x2);
q[x].b=y1-q[x].kx1;
}else{
q[x].l=p[x].x-CK;q[x].r=p[y].x-AI;
dl x1=q[x].l,y1=py(CG,CK);
dl x2=q[x].r,y2=py(AB,AI);
q[x].k=(y1-y2)/(x1-x2);
q[x].b=y1-q[x].kx1;
}
}
int main(){
scanf("%d%lf",&n,&alpha);
alpha=1.0/tan(alpha);
for(int i=1;i<=n+1;i++){
scanf("%lf",&p[i].x);
p[i].x=alpha;
p[i].x+=p[i-1].x;
}
for(int i=1;i<=n;i++)scanf("%lf",&p[i].r);
p[n].r=0;
for(int i=1;i<n;i){
getl(i,i+1);
}
dl l=p[1].x-p[1].r,r=p[n].x;
for(int i=1;i<=n;i2024-09-15 来自 浙江
0点第二个!!!!
2024-08-17 来自 广东
02024-08-17 来自 广东
0
有帮助,赞一个