"How do I can solve the problem coins on a star" ...
Firstly you do some research:
Google[
^]
From the 2nd link on that search I learn that the problem can be solved using the "greedy strategy" or the "buttons and strings" method.
Then I can find all sorts of information on the
Greedy Strategy Algorithm[
^]
Not so much for
Buttons and Strings[
^] but still enough to go on.
Don't forget to follow the constraints listed in the assignment - which are giving some indication of which method to choose.
Once you have decided the "how" to do it, write some code to actually achieve the solution. If you get into problems with your code then come back with that code and we will try to help.