Problem Link :- https://mycode.prepbytes.com/problems/maths/CHERRED
My approach :-
there are n candies and he want to earn c and alice will pay x for each candies and john will pay y for each candies.
let us say alice buys r1 candies and jhon buys r2 candies than a valid distribution will be r1x + r2y = c
by this we get r2 = (c - r1x)/y Now we will find the value of
r2 for r1 equals 0 to n if we get a valid r2 ( a valid r2 means if (c-r1x)%y==0 )
then we will if (r1+r2<=n) then we will increase our count as this will be a valid