Please provide Editorial for Magical Coins of April Lunch Time 2021

Please someone help in solving the problem mentioned in Link Above. How to calculate the value of r in the above problem. Will I have to take r from 1 to n or r=ng? Please provide the editorial if possible.

Do you have any experience with generating functions ?

No, Brother I don’t have any experience in generating function!

I recommend you to read some basics of generating functions and then look at the coefficients in expansion of the following generating function.

F(x)=e^{bx}(1+e^{ax})^n

You’ll get the pattern I’m talking about.

1 Like

You will also have to read about NTT which will be required for multiplication of coefficients.

Hi,
You can read my comment here but you need to have good hold on NTT and Generating functions to solve the problem.

Thank You Brother, I am working on it now, I got to know about new concept today.