整数子集表示
Find the smallest subset of integers
题目详情
求最小规模的整数子集,使得可仅用“+”或“-”(且每个数最多使用一次)表示出 。
英文原题
Find the smallest subset of integers that you can use to produce 1,2,..., 40 by only using “+” or “- ” (each number in the subset can be used at most one time).
解析
若子集有 个数,每个数可“+用 / -用 / 不用”三种状态,所以最多得到 个不同和值。
要覆盖 (连同对应负数与 0,至少需要 81 个值:),故
4 个数是否可行?取
任意系数取 ,可得到平衡三进制表示,覆盖区间
因此最小规模为 4,最小子集可取
英文解析
If a subset has numbers, and each number can be in one of three states ("used plus", "used minus", or "not used"), then at most distinct sums can be obtained.
To cover the range (including the corresponding negative numbers and , requiring at least values: ), we have
Is feasible? Taking
By choosing any coefficients from , we can obtain a balanced ternary representation, covering the interval
Thus, the minimum size is , and a possible minimum subset is