Write a program that, given an integer number and integer numbers , prints the subset (maybe with repeated numbers, but using every at most once) lexicographically largest among those whose sum is .
Input consists of an integer number , followed by a number , followed by .
Print, with the elements sorted non-increasingly, the subset that is
greatest in lexicographical order among those that can be made up with
and whose sum is
.
If there is none, print “no solution”.
Sort the given numbers.
Author: Unknown
Translator: Carlos Molina
Generation: 2026-01-25T11:58:26.197Z
© Jutge.org, 2006–2026.
https://jutge.org