Hello! I have a set that contains maximum 10^6 items. All item are 4^n number, where 0 <= n <= 11, all items have a price that can be 1 <= price <= 10^8. And I also have another number k, where k is 4^n number and 0 <= n <= 11. The items are ordered monotonically first according to size of numbers, then to prices. I want to take the sum of the items that equal to number k, and the price is minimal. The example: A := {16(1),16(2),16(3),16(4),64(11)}and k=64. (format: Number (price) -> 16(1)) So, the solution is 16(1),16(2),16(3),16(4), because 1+2+3+4=10 smaller then 11. Any idea? Thanks!
P
paradoxonok
@paradoxonok