国内网站域名,苏州网站建设永阳网络,crm客户管理系统登陆,濮阳网官网Swimming Balls https://vjudge.net/contest/318752#problem/J如果直接算#xff0c;各种球的情况都不清楚#xff0c;因为放一个球之后#xff0c;水位的变化也会影响之前放入的球#xff0c;不如#xff0c;二分最终的水位高度#xff0c;这样每个球的贡献就有了 #incl… Swimming Balls https://vjudge.net/contest/318752#problem/J如果直接算各种球的情况都不清楚因为放一个球之后水位的变化也会影响之前放入的球不如二分最终的水位高度这样每个球的贡献就有了 #include iostream
#include cstdio
#include queue
#include algorithm
#include cmath
#include cstring
#define inf 2147483647
#define N 1000010
#define p(a) putchar(a)
#define For(i,a,b) for(int ia;ib;i)
//by war
//2019.8.16
using namespace std;
int T,n;
double L,x,y,mid,W,D,V,w[N],r[N],eps1e-10,ans,pai3.141592653589793;
void in(int x){int y1;char cgetchar();x0;while(c0||c9){if(c-)y-1;cgetchar();}while(c9c0){ x(x1)(x3)c-0;cgetchar();}x*y;
}
void o(int x){if(x0){p(-);x-x;}if(x9)o(x/10);p(x%100);
}double v(double r){return 4.0000000/3.00000000*pai*r*r*r;
}double deal(double h,int i){return pai*(r[i]*r[i]*h-h*h*h/3.0);
}double lj(double x,int i){if(x-r[i]eps)return v(r[i])/2.0deal(min(r[i],x-r[i]),i);return v(r[i])/2.0-deal(r[i]-x,i);
}bool check(double x){double tV;For(i,1,n){if(1.0000000-w[i]eps)tmin(v(r[i])*w[i],lj(x,i));elsetlj(x,i);}if(t/W/L-xeps)return 1;return 0;
}
signed main(){in(T);while(T--){in(n);cinWLDV;if(Veps){puts(0.0000000000);continue;}For(i,1,n)cinr[i]w[i];x0;yDeps;while(y-xeps){mid(xy)/2.0;if(check(mid))xmid;elseymid;}printf(%.10f\n,mid);}return 0;
} 转载于:https://www.cnblogs.com/war1111/p/11375679.html