0%

Problem 828


Problem 828


Numbers Challenge

It is a common recreational problem to make a target number using a selection of other numbers. In this problem you will be given six numbers and a target number.

For example, given the six numbers $2$, $3$, $4$, $6$, $7$, $25$, and a target of $211$, one possible solution is:
$$211 = (3+6)\times 25 − (4\times7)\div 2$$
This uses all six numbers. However, it is not necessary to do so. Another solution that does not use the $7$ is:
$$211 = (25−2)\times (6+3) + 4$$

Define the score of a solution to be the sum of the numbers used. In the above example problem, the two given solutions have scores $47$ and $40$ respectively. It turns out that this problem has no solutions with score less than $40$.

When combining numbers, the following rules must be observed:

  • Each available number may be used at most once.
  • Only the four basic arithmetic operations are permitted: $+$, $-$, $\times$, $\div$.
  • All intermediate values must be positive integers, so for example $(3\div 2)$ is never permitted as a subexpression (even if the final answer is an integer).

The attached file number-challenges.txt contains $200$ problems, one per line in the format:
$$211:2,3,4,6,7,25$$
where the number before the colon is the target and the remaining comma-separated numbers are those available to be used.

Numbering the problems $1$, $2$, …, $200$, we let $s_n$ be the minimum score of the solution to the $n$th problem. For example, $s_1=40$, as the first problem in the file is the example given above. Note that not all problems have a solution; in such cases we take $s_n=0$.

Find $\displaystyle\sum_{n=1}^{200} 3^n s_n$. Give your answer modulo $1005075251$.


凑数挑战

从一些数出发,经过运算得到某个目标数,是一种常见的数学趣题。在本题中,每道题都有六个起始数和一个目标数。

例如,给定起始数$2$、$3$、$4$、$6$、$7$、$25$和目标数$211$,其中一个解是:
$$211 = (3+6)\times 25 − (4\times7)\div 2$$
这个解用到了所有六个起始数,但这并不是必须的。另一个没有用到$7$的解是:
$$211 = (25−2)\times (6+3) + 4$$

记一个解的得分为所有用到的起始数之和。在如上的例子中,两个解的得分分别是$47$和$40$,而且这道题不存在得分低于$40$的解。

对于运算过程,我们作出如下规定:

  • 每个起始数至多被使用一次。
  • 只能使用四则运算:$+$、$-$、$\times$、$\div$。
  • 所有中间结果必须是整数,因此如$(3\div 2)$之类的数不能作为中间结果(即使最终结果是整数)。

在文本文件number-challenges.txt中包含有$200$个此类趣题,每行一个,其格式为:
$$211:2,3,4,6,7,25$$
其中,冒号前的数是目标数,冒号后用逗号隔开的是起始数。

将这些题目编号为$1$、$2$、……、$200$,并记$s_n$为第$n$题的最小得分。例如,第一题就是上述例题,因此$s_1=40$。有些题可能无解,此时记$s_n=0$。

求$\displaystyle\sum_{n=1}^{200} 3^n s_n$,并将你的答案对$1005075251$取余。