Unverified Commit f1870bae authored by mgt/Enter-tainer's avatar mgt/Enter-tainer Committed by GitHub
Browse files

Merge pull request #2642 from Falicitas/patch-2

parents 81557f5a 71964ca6
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -79,6 +79,26 @@ $$
\texttt{ 100Z10} = 243 \cdot 1 + 81 \cdot 0 + 27 \cdot 0 + 9 \cdot (-1) + 3 \cdot 1 + 1 \cdot 0 = 237_{10}
$$

## 平衡三进制的唯一性

对于一个平衡三进制数 $X_3$ 来说,其可以按照每一位 $x_i$ 乘上对应的权值 $3^i$ 来唯一得到一个十进制数 $Y_{10}$ 。那对于一个十进制数 $Y_{10}$ ,是否 **唯一对应一个平衡三进制数** 呢?

答案是肯定的。

我们利用 **反证法** 来求证:

假设一个十进制数 $Y_{10}$ ,存在两个 **不同的平衡三进制数**  $A_3,B_3$ 转化成十进制时等于 $Y_{10}$ ,即证 $A_3 = B_3$ 。分情况讨论:

> 1. 当 $Y_{10}=0$ ,显然 $A_3 = B_3 = 0_3$ ,与假设矛盾。
> 2.  当 $Y_{10}>0$ :
>
>     - 将 $A_3$ ,$B_3$ 的数位按低位到高位编号,记 $a_i$ 为 $A_3$ 的第 $i$ 位,$b_i$ 为 $B$ 的第 $i$ 位。 在 $A_3,B_3$ 中,必存在 $i$ 使得 $a_i\neq b_i$ 。可以发现第 $i-1,i-2,\dots,0$ 位均与证明无关。因此,将 $A_3,B_3$ 按位右移 $i$ 位,得到 $A_3',B_3'$ ,原问题等价于证明 $A_3'=B_3'$ 。
>
>     - 对于 $A_3',B_3'$ 第 $0$ 位, $a_0 \neq b_0$ 。假设 $b_0 > a_0$ ( $a_0>b_0$ 时结果相同),易知 $b_0 - a_0 \in \{1,2\}$ 。 $A_3'$ 的位 $i=1,2,3,...$ 对于 $A_3'$ 的值的贡献为 $S_1 = a_1 \times 3^1 + a_2 \times 3^2+ \dots$ , $B_3'$ 的位 $i=1,2,3,...$ 对于 $B_3'$ 的值的贡献为 $S_2 = b_1 \times 3^1 + b_2 \times 3^2 + \dots$ 。由于 $A_3' = B_3'$ ,得 $S_1 - S_2 = b_0 - a_0$ 。 $S_1,S_2$ 有公因子 $3$ ,而 $b_0 - a_0$ 不能被 $3$ 整除,与假设矛盾,因此 $A_3'\neq B_3'$
> 3. 当 $Y_{10}<0$ ,证法与 $Y_{10}>0$ 相同。

故对于任意十进制 $Y_{10}$ ,均有唯一对应的平衡三进制 $X_3$ 。

## 练习题

 [Topcoder SRM 604, Div1-250](https://community.topcoder.com/stat?c=problem_statement&pm=12917&rd=15837)