CF1551A Polycarp and Coins

题目描述

Polycarp 需要精确地支付 $n$ 元。他有两种面额的硬币:一种是 $1$ 元,一种是 $2$ 元。Polycarp 对于希望所支付的两种硬币数量差尽可能小。 您需要帮助 Polycarp 确定两个非负整数数 $c_1$ 和 $c_2$,分别对应 $1$ 元硬币和 $2$ 元硬币的数量。所以应当满足 $c_1 + 2 \cdot c_2 = n$ 且 $|c_1 - c_2|$最小。

输入格式

输出格式

说明/提示

The answer for the first test case is "334 333". The sum of the nominal values of all coins is $ 334 \cdot 1 + 333 \cdot 2 = 1000 $ , whereas $ |334 - 333| = 1 $ . One can't get the better value because if $ |c_1 - c_2| = 0 $ , then $ c_1 = c_2 $ and $ c_1 \cdot 1 + c_1 \cdot 2 = 1000 $ , but then the value of $ c_1 $ isn't an integer. The answer for the second test case is "10 10". The sum of the nominal values is $ 10 \cdot 1 + 10 \cdot 2 = 30 $ and $ |10 - 10| = 0 $ , whereas there's no number having an absolute value less than $ 0 $ .