A tower has 100 rows of glasses. Row r contains glasses numbered 0 through r, and each glass holds one cup. Pour poured cups into glass (0,0). A glass keeps up to one cup and divides any excess equally between glasses (r+1,c) and (r+1,c+1) directly below it. Excess below the last row is discarded. Return the amount in glass (query_row,query_glass) after the liquid settles, as a number from 0 to 1. Rows and columns are zero-indexed.
Hatching shows how full each glass is; the dashed box marks the queried glass.
Example 1:
Input: poured = 4
query_row = 2
query_glass = 1
Output: 0.5Explanation: The top glass keeps 1 cup and sends 1.5 cups to each glass in row 1. Each of those glasses sends 0.25 cups to the middle glass in row 2, giving it 0.5 cups.
Example 2:
Input: poured = 4
query_row = 2
query_glass = 0
Output: 0.25Explanation: Each glass in row 1 receives 1.5 cups. The leftmost glass in row 2 receives half of the left parent's 0.5-cup excess, so it contains 0.25 cups.
Example 3:
Input: poured = 0
query_row = 0
query_glass = 0
Output: 0.0Explanation: No liquid is poured, so the top glass stays empty.
Constraints:
0 <= poured <= 10000000000 <= query_glass <= query_row < 100