There is a two-dimensional pyramid of bricks. The weight of the 1st - 1 kg, crushes evenly for 2 below it at 0.5 kg. That is, if the upper one presses +100 kg, then below it each will be (100 + 1) / 2 kg - the lower one presses the weight of each one above it.
1,0 = .5 2,0 = .75 2,1 = 1.5 3,0 = .875 3,1 = .2.125
How to calculate the pressure on any of them, indicating the position, for example, k4-2, k8-4 ... k (row Above, number Left) - as a function with 2 parameters, which returns the weight?
I thought, a number of * .5 + (number of 1) / 2 or 1 * (c + 1) / 2 * p + 1 * c / 2 * p, various other options, but I just can not find the exact one. (preferably on java)