← 返回 bytedance 的题目列表Champagne Tower Overflow Amount Calculation
类型:online_judge
bytedance
We have a triangle-shaped wine tower where the first row has 1 glass, the second row has 2 glasses, and so on. The glasses are arranged such that they overflow evenly, where the overflowed champagne gets equally distributed between the glasses in the next row. You pour champagne into the topmost glass. After pouring, you need to determine the amount of champagne in a specific glass at a certain row. Each glass can hold one cup of champagne. Write a function that takes the poured champagne units, the query row, and the target glass index in that row and returns how much champagne is in that glass.
Example
Input
25
3
2