五位数:任意两位数字和两两不同
Pairwise Digit Sums II
题目详情
设集合 为所有 5 位正整数,使得其 5 个数字的所有两两和(共 个)都互不相同。
例如,一个满足该性质的 3 位数是 174(其两两和 1+7=8、1+4=5、7+4=11 各不相同)。
设 与 分别为 中的最小元素与最大元素,求 。
Let be the set of 5 digit integers such that all pairwise sums of digits are unique. For example, a three digit number with this property is . Let and be the minimal and maximal elements of , respectively. Find .
解析
用程序穷举 10000..99999 可得到:
- 最小 。
- 最大 。
因此