#include<iostream> #include<cstdio> #include<cstdlib> #include<string> #include<cstring> #include<cmath> #include<ctime> #include<algorithm> #include<utility> #include<stack> #include<queue> #include<vector> #include<set> #include<map> #include<bitset> #define PI acos(-1.0) #define INF 0x3f3f3f3f #define LL long long #define Pair pair<int,int> const double EPS = 1E-10; const int MOD = 1E9+7; const int N = 1000000+5; const int dx[] = {-1,1,0,0,-1,-1,1,1}; const int dy[] = {0,0,-1,1,-1,1,-1,1}; using namespace std; double H,h,D; double cal(double x){ double tanA=(H-h)/x; double d=H/tanA; if(d<=D) return d-x; d=d-D; return D-x+d*tanA; } int main() { int t; scanf("%d",&t); while(t--){ scanf("%lf%lf%lf",&H,&h,&D); double left=0,right=D; while(right-left>=EPS){ double lmid=left+(right-left)/3.0; double rmid=right-(right-left)/3.0; if(cal(lmid)<cal(rmid)) left=lmid; else right=rmid; } printf("%.3lf\n",cal(left)); } return 0; }
0.0分
1 人评分
C语言程序设计教程(第三版)课后习题10.1 (Java代码)浏览:1492 |
C语言程序设计教程(第三版)课后习题8.8 (C语言代码)浏览:1482 |
A+B for Input-Output Practice (IV) (C语言代码)浏览:513 |
C语言程序设计教程(第三版)课后习题9.3 (C语言代码)浏览:650 |
C二级辅导-计负均正 (C语言代码)浏览:523 |
C二级辅导-阶乘数列 (C语言代码)浏览:583 |
震宇大神的杀毒软件 (C语言代码)浏览:1162 |
输入输出格式练习 (C语言代码)浏览:883 |
C语言训练-自守数问题 (C语言代码)浏览:798 |
简单的a+b (C语言代码)浏览:444 |