Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
我的代码长度竟然排第一了。。。一般都是垫底: #include<iostream> #include<cstdlib> #include<cstring> #include<algorithm> #include<cmath> #include<stdio.h> using namespace std; double H,R,D1,h1,D2,h2,D,n; const double pi=acos(-1.),eps=1e-9; int main() { scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&H,&R,&D1,&h1,&D2,&h2,&D,&n); double v,hm,ans,v1,v2,vd,hd; v=D*n*n*n/D2; hm=pi*R*R*h2/(pi*R*R-n*n); hd=pi*R*R*(h1+h2)/(pi*R*R-n*n); vd=n*n*hd; vd=min(vd,n*n*n); if(v<vd-eps&&v<=n*n*hm) ans=h1+h2+v/(pi*R*R); else { v2=n*n*hm; v1=(D*n*n*n-D2*v2)/D1; if(v1>=0) ans=h1+h2+min(vd,(v1+v2))/(pi*R*R); else ans=h1+h2+vd/(pi*R*R); } ans=min(ans,H); printf("%.20f\n",ans); return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator