编程介的小学生 2017-08-05 09:22 采纳率: 20.5%
浏览 820
已采纳

Collision Ball Game

Collision ball game is one of my favorite game when I was young. I was so fond of this game that I nearly decided to be a physical scientist (But I am not now). Firstly I wanted to construct a problem to describe the whole process of this game. But it is too difficult for me and I hate being bsed by others for wrong data.

So I decide to make it easier, but maybe I will construct one next time.

Assume the game is in a triangle with the lower-right angle k (in degree) and height h. (see the picture)

The ball's initial place is in (0, a) and it eventually arrives at (b, 0) with collising the bevel edge only once. The two points (0, a) and (b, 0) will always be on the edge of the triangle.

You are to calculate the distance the ball pass. The process of collision obey the physical law. The angle of incidence equals to the angle of reflection.

Input

The input contains multiple test cases. Each test cases contain four number (all double). The first line is the angle of the triangle k (in degree, 0 < k < 90). The second line is the height h (h > 0). The third line is a. The fourth line is b (a, b >= 0).

Process to the end-of-file.

Output

For each test case print a single line that contains the distance the ball pass (rounded to 2 decimal places).

Sample Input

45
2
1
1

30
2
1
2.3094
Sample Output

2.00
2.89

  • 写回答

2条回答 默认 最新

  • threenewbee 2017-08-07 15:26
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码