CF1846D Rudolph and Christmas Tree
Description
Rudolph drew a beautiful Christmas tree and decided to print the picture. However, the ink in the cartridge often runs out at the most inconvenient moment. Therefore, Rudolph wants to calculate in advance how much green ink he will need.
The tree is a vertical trunk with identical triangular branches at different heights. The thickness of the trunk is negligible.
Each branch is an isosceles triangle with base $ d $ and height $ h $ , whose base is perpendicular to the trunk. The triangles are arranged upward at an angle, and the trunk passes exactly in the middle. The base of the $ i $ -th triangle is located at a height of $ y_i $ .
The figure below shows an example of a tree with $ d = 4, h = 2 $ and three branches with bases at heights $ [1, 4, 5] $ .
Help Rudolph calculate the total area of the tree branches.
Input Format
N/A
Output Format
N/A