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
This uses all six numbers. However, it is not necessary to do so. Another solution that does not use the
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
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
The attached file number-challenges.txt contains 200 problems, one per line in the format:
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
Find
通过某些数字,对其进行运算,来得到目标数字,是数学圈常见的一种消遣。本题中,你需要用六个数字通过运算得到目标数字。
例如,给定六个数字
这个解法用上了所有的六个数。但这其实没有必要,下面的这个解法就没有使用
定义一个解法的分数为所有使用的数字之和。以上两个解法的分数分别为
在用运算组合数字的时候,必须遵守以下规则:
每个给定的数字至多使用一次。
只能对数字进行四则运算。
所有中间量都必须是整数。所以
下发文件 number-challenges.txt 包括 200 道题目,每道题的格式如下:
冒号前的数字是目标数字,而后面六个用逗号隔开的数字就是给定的数字了。
将所有题目编号为
求
点 这个链接 回到源站。
点 这个链接 回到详细版题目目录。