#P6988. [NEERC2014] Damage Assessment

[NEERC2014] Damage Assessment

题目描述

A tank car that transports gasoline via rail road has a shape of cylinder with two spherical caps at the sides. The cylinder has a diameter \(d\) and a length \(l\). The spherical caps have a radius \(r\) (\(2r\) \ge \(d\)). There was the rail road accident and the tank car had derailed. It now lies on the ground and some of the stored gasoline had flown out. The damage assessment must be performed. The location of the tank on the ground was established by measuring its tilt as the height difference \(t\) from the bottom points of the cylinder on its left and right sides (0 \le \(t\) \le \(l\)). The level of gasoline in the tank was established by measuring the height difference \(h\) from the bottom point of the cylinder and the top level of gasoline. For the purpose of this problem, the top level of gasoline always intersects the cylinder part of the tank (0 \le \(h\) \le \(t + d \sqrt{1 - (t/l)^2}).

Your task is to figure out how much gasoline was left in the tank.

输入格式

The input file consists of a single line with five integer numbers -- \(d\), \(l\), \(r\), \(t\) and \(h\), which represent the diameter and the length of the tank's cylinder part, the radius of its spherical caps, tilt and gasoline level measurements. They are all expressed in millimeters (11 millimeter =103= 10^{−3} meters), they satisfy all constraints expressed in the problem statement and $\(d\), \(l\) \ge 100 , \(d\), \(l\), \(r\) \le 10 000$ .

输出格式

Write a single real number to the output file -- the volume of gasoline in the tank in liters (11 liter =103= 10^{−3} cubic meters). The absolute error of the answer must not exceed 00 . 11 liters.

题目大意

有一个由一个长度为 ll,底面直径为 dd 的圆柱和两个半径均为 r (2rd)r\ (2r\ge d) 的球形盖组成的油箱。由于一个交通事故,该油箱现在倾斜了一个角度,有一些汽油被洒了出来。现在给定圆柱底部的左右两个端点的高度差 t (0tl)t\ (0\le t\le l) 以及剩余汽油的水平面到圆柱底端的距离 hh,保证汽油的水平面一定与油箱的圆柱部分有交,即 (0ht+d1(t/l)2)(0\le h\le t+d\sqrt {1-(t/l)^2})。所有长度单位均用毫米给出。

求还剩下多少汽油(升),精确到 0.10.1

d,l100d,l\ge 100d,l,r104d,l,r\le 10^4

下图为原题图。

3000 6000 1600 0 3000

50974.56

3000 6000 1600 3441 4228

40728.90

提示

Time limit: 1 s, Memory limit: 256 MB.