topic description
similar to the problem of N SUM, the idea comes from a small task encountered in the work, abstracted out:
has m items, and gives the unit price of each item, P1 br P2, P3 br. Now there are n orders, and the total amount of each order is S1Magi S2, S3 br. SN (P < S)
now requires matching as many product price * quantity combinations as possible for the total Sn of each order. The left and right sides of the equation are as close as possible:
Sn=P1 quantity + p2 quantity +.
solution
solve the problem with python