This is the problem of cses coin piles. I wanted to know can this problem be generalized? like for removing p coins from left pile and q coins from right pile and vice versa.
I tried doing it but wasn't able to figure it out. And didn't even know how to check if the solution is correct or not.









Auto comment: topic has been updated by death_bringer (previous revision, new revision, compare).
Auto comment: topic has been updated by death_bringer (previous revision, new revision, compare).
You need to solve equation: $$$a = l \cdot p + r \cdot q$$$ and $$$b = l \cdot q + r \cdot p$$$ where $$$l, r \geq 0$$$