2018 ICPC 焦作 现场 (几何数学,分类讨论)

题意:

       一辆长为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   \frac{|a - b|}{\max\{1, |b|\}} \leq 10^{-6} 。

Example

input

4
1 2 2 120
1 2 2 60
1 2 2 30
1 2 2 15

output

1.605551275464
1.605551275464
1.598076211353
1.415415569072

思路:

        几何题几乎没做过,大佬真的强。。。虽然这是个高中数学题。。。

        该题分了两种情况讨论:

        一种情况是,弯道路段比较长(比如接近一个圆),此时所需要道路最长

宽度等于弯道圆心到车左后灯的距离减去圆半径。

        另一种情况弯道距离比较短,上面描述的长度不会出现和路牙石垂直的情况,

所以此时的道路宽度是小于那个值的。

        具体这两种情况怎么区分,是通过弯道圆心角  和 半径与圆心到左后灯连线

形成的角度 的      相对大小确定的。

代码实现:

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值