题意:
一辆长为a,宽b的车漂移过弯,车头总是和内弯相切,已知弯道的圆心
角和半径d,求道路宽度的最小值。
Input
The input contains several test cases, and the first line contains a positive integer
T indicating the number of test cases which is up to 10^4.
For each test case, the only one line contains four integers aa, bb, rr and dd,
where 0<a,b,r<100 and 0<d<180.
Output
For each test case, output a line containing the minimal width (in inches) of the lane
with an absolute or relative error of at most 10^−6. Precisely speaking, assuming that
your answer is aa and the jury's answer is b, your answer will be considered correct
if
。
Example
input
4 1 2 2 120 1 2 2 60 1 2 2 30 1 2 2 15output
1.605551275464 1.605551275464 1.598076211353 1.415415569072
思路:
几何题几乎没做过,大佬真的强。。。虽然这是个高中数学题。。。
该题分了两种情况讨论:
一种情况是,弯道路段比较长(比如接近一个圆),此时所需要道路最长
宽度等于弯道圆心到车左后灯的距离减去圆半径。
另一种情况弯道距离比较短,上面描述的长度不会出现和路牙石垂直的情况,
所以此时的道路宽度是小于那个值的。
具体这两种情况怎么区分,是通过弯道圆心角 和 半径与圆心到左后灯连线
形成的角度 的 相对大小确定的。
代码实现: