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)×25(4×7)÷2
This uses all six numbers. However, it is not necessary to do so. Another solution that does not use the 7 is:
211=(252)×(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: +, , ×, ÷.
  • All intermediate values must be positive integers, so for example (3÷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 sn be the minimum score of the solution to the nth problem. For example, s1=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 sn=0.

Find n=12003nsn. Give your answer modulo 1005075251.


凑数挑战

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

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

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

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

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

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

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

n=12003nsn,并将你的答案对1005075251取余。


Gitalking ...