FZU2095 水面高度
生活随笔
收集整理的這篇文章主要介紹了
FZU2095 水面高度
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
一共六種情況。手算即可。
#include<cstdio> #include<cstring> #include<cmath>int T; double a,b,c,d,x; double ans;int main() {scanf("%d",&T);while(T--){scanf("%lf%lf%lf%lf%lf",&a,&b,&c,&d,&x);double h=sqrt(c*c-x*x*c*c/(a*a));double p=x*c/a;double tmp=a*d;if(x<=h){double m=a*a/sqrt(a*a-x*x);double s1=m*x/2;double s2=a*c-m*x;double s3=m*x/2;if(tmp<=s1) ans=sqrt(tmp/s1)*x;else if(tmp<=s1+s2) ans=(tmp-s1+m*x)/m;else ans=x+h-sqrt((a*c-tmp)/s1)*x;}else{double m=c*c/p;double s1=m*h/2;double s2=a*c-m*h;double s3=m*h/2;if(tmp<=s1) ans=sqrt(tmp/s1)*h;else if(tmp<=s1+s2) ans=(tmp-s1+m*h)/m;else ans=h+x-sqrt((a*c-tmp)/s1)*h;}printf("%.2lf\n",ans);}return 0; }?
轉(zhuǎn)載于:https://www.cnblogs.com/zufezzt/p/5281999.html
總結(jié)
以上是生活随笔為你收集整理的FZU2095 水面高度的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 深度分析 Java 的 ClassLoa
- 下一篇: php的几种运行模式CLI、CGI、Fa