Find Water In Glass

1. Pepcoder arranged some glasses in the form of pascal triangle.
2. Capacity of each glass is 1 litre. If you pour K amount of water in a glass, it will retain 1 litre and
rest of it gets equally distributed in left bottom glass and right bottom glass.
3. If pepcoder pours K litres of water in the topmost glass, you have to find out the amount of water in Cth glass of Rth row.

Assumption -> There are enough glasses in the triangle till no glass overflows.
Input Format
A number K representing amount of water poured in topmost glass.
Two numbers R and C
Output Format
A number representing the amount of water present in Cth glass of Rth row.
Question Video
1 <= K <= 500
1 <= R,C <= K
Sample Input
Sample Output

  • Asked in Companies
  • Related Topics

Video Solution

Code Solution

Id Name