两次提问确定三个数
2 Equations & 3 Unknowns
题目详情
我想了三个自然数 。
你可以向我问两次问题:每次你给出整数系数 ,我会告诉你 的值。
如何通过两次提问保证确定 ?
I guessed 3 natural numbers - . You can ask me 2 sums of these numbers with any integer coefficients - . That is, you give me a, b and c and I tell you the result of the expression . Seeing the answer, you then give me the 2nd triplet of & I will tell . Give me the algorithm to find , and .
Hint
If digits are small, we can solve any number of variables by asking etc. just by reading these numbers between the zeros of result.
解析
关键是先用一次提问估计出位数上界,再用“进位分隔”的方式把三个数编码进一次和里。
-
先问 得到 ,从而得到三者的位数上界(例如 )。
-
再问 得到
由于 足以分隔位数,可以从十进制展开中直接读出 。
Original Explanation
Solution
Since they are natural numbers, if you knew the maximum number of digits any of them can have, say d, you could set a=1, b=10^d, c=10^2d, and you would be able to read the d-digit numbers directly. So, you use the first calculation to find the maximum number of digits, . let digits of this result Then, set Let the sum be . Then (first digits of ), to -digits of S, = to digits of
Thus, we note that its posssible to solve for n natural numbers with just questions.