I have a list of goods. The quantity of goods is a multiple of 3 and lies in the range from 3 to 15. I enter the number of goods and put them a rating from 1 to 10. Then, based on the rating, I have to put down the price of $ 1, $ 2 or $ 3, so that the number of money was the same.
I give an example. 6 products with a rating of [1 6 8 2 9 3] A table with money will be like this [1 $ 2 $ 3 $ 1 $ 3 $ 2 $]
What algorithm to implement this dependence?