To introduce the problem think to my neighbor who drives a tanker truck. 
The level indicator is down and he is worried
because he does not know if he will be able to make deliveries. 
We put the truck on a horizontal ground and measured the height of the liquid in the tank.

Fortunately the tank is a perfect cylinder and the vertical walls on each end are flat.
The height of the remaining liquid is `h`, the diameter of the cylinder is `d`,
the total volume is `vt` (h, d, vt are positive or null integers). 
You can assume that `h` <= `d`.

Could you calculate the remaining volume of the liquid?
Your function `tankvol(h, d, vt)` returns an integer which is the truncated result (e.g floor)
of your float calculation.

Examples:

```
tankvol(40,120,3500) should return 1021 (calculation gives about: 1021.26992027)

tankvol(60,120,3500) should return 1750

tankvol(80,120,3500) should return 2478 (calculation gives about: 2478.73007973)
```

Tank vertical section:

![alternative text](http://i.imgur.com/wmt0U43.png)

Difficulty: EASY
Starter code: def tankvol(h, d, vt):
	

Solutions:
import math

def tankvol(h, d, vt):
	r = d / 2.0
	if h == r:
		return vt / 2
	half = h > r
	h = d - h if half else h
	a = r - h
	b = math.sqrt(r ** 2 - a ** 2)
	t = 2 * math.asin(b / r)
	A = r ** 2 * t / 2 - b * a
	v = vt * A / (math.pi * r ** 2)
	return int(vt - v) if half else int(v)


import math

def tankvol(h, d, vt):
	r = d / 2
	theta = math.acos((r - h) / r)
	return int(vt * (theta - math.sin(theta) * (r - h) / r) / math.pi)


import math

def tankvol(h, d, vt):
	r = d / 2
	area_of_liquid = r ** 2 * math.acos(1 - h / r) - (r - h) * (2 * r * h - h * h) ** 0.5
	height_of_cylinder = vt / (math.pi * r * r)
	volume_of_liquid = area_of_liquid * height_of_cylinder
	return math.floor(volume_of_liquid)


from math import sin, acos, pi

def tankvol(h, d, vt):
	r = d / 2.0
	theta = 2 * acos(1 - h / r)
	A_segment = r ** 2 / 2 * (theta - sin(theta))
	A_circle = r ** 2 * pi
	ratio = A_segment / A_circle
	vol_remain = ratio * vt
	return int(vol_remain)


from math import pi, acos, sin

def tankvol(h, d, vt):
	theta = acos((d - 2 * h) / d)
	proportion = (theta - 0.5 * sin(2 * theta)) / pi
	return int(proportion * vt)


import math

def tankvol(h, d, vt):
	return math.floor((d * d / 4 * math.acos(1 - h / (d / 2)) - math.sqrt(d * d / 4 - (d / 2 - h) ** 2) * (d / 2 - h)) * vt / (math.pi * d ** 2 / 4))


from math import acos, pi, sin, sqrt

def tankvol(h, d, vt):
	r = d / 2
	l = vt / (pi * r ** 2)
	v = l * (r ** 2 * acos((r - h) / r) - (r - h) * sqrt(2 * r * h - h ** 2))
	return int(v)


from math import asin, sin, pi

def tankvol(h, d, vt):
	a = pi - 2 * asin(1 - 2 * h / d)
	return vt * (a - sin(a)) / pi // 2


from math import floor, degrees, acos, pi, sin, radians

def calc_theta(a, b):
	return degrees(acos(a / b))

def calc_circle_segment_area(r, alpha):
	return pi * r ** 2 * (alpha / 360)

def calc_triangle_area(r, alpha):
	return r ** 2 * sin(alpha) / 2

def calc_cylinder_height(r, vt):
	return vt / (pi * r ** 2)

def tankvol(h, d, vt):
	r = d / 2
	theta = calc_theta(r - h, r)
	angle = theta * 2
	segment_area = calc_circle_segment_area(r, angle)
	triangle_area = calc_triangle_area(r, radians(angle))
	cylinder_height = calc_cylinder_height(r, vt)
	liquid_area = segment_area - triangle_area
	liquid_volume = liquid_area * cylinder_height
	return floor(liquid_volume)


import math

def tankvol(h, d, vt):
	l = vt / (math.pi * (d / 2) ** 2)
	r = d / 2
	partOne = r ** 2 * math.acos((r - h) / r)
	partTwo = (r - h) * math.sqrt(2 * r * h - h ** 2)
	vs = l * (partOne - partTwo)
	return math.floor(vs)