No.1337 Fair Otoshidama
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Show the original
Problem Statement
There are three people, A, B, and C, and each of them initially has the same amount of $100$ yen. The three of them then received otoshidama (New Year's money). It seems that A received $X$ yen, B received $Y$ yen, and C received $Z$ yen.
The three are good friends, so they want to share their money so that everyone has the same amount. However, simply dividing it normally would be boring, so they decided to share it by repeating the following operation.
- Choose one of the following three operations and perform it.
- A receives $1$ yen from B.
- B receives $2$ yen from C.
- C receives $3$ yen from A.
- However, after an operation, none of the three may have a negative amount of money.
Is it possible to make the amounts of money of the three people equal?
Input
$X\ \ Y\ \ Z$
[Constraints]
・$1\le X,Y,Z\le 10^9$
・All inputs are integers.
Output
Print Yes if it is possible to make the amounts of money of the three people equal by repeating the operations,
and No if it is impossible.
Sample
Sample 1
Input
3 2 1
Output
Yes
For example, the goal can be achieved by performing the operations as follows.
$(A くんの所持金, B くんの所持金, C くんの所持金 )$
$=(103,102,101)$
$\rightarrow(104,101,101)$
$\rightarrow(104,103,99)$
$\rightarrow(101,103,102)$
$\rightarrow(102,102,102)$
(Operation 1 → Operation 2 → Operation 3 → Operation 1)
Sample 2
Input
3 1 4
Output
No
In this case, no matter how the operations are performed, the amounts of money of all three people never become equal.
Sample 3
Input
6 6 6
Output
Yes
There are cases where no operation is necessary.
Sample 4
Input
854828273 492381600 63609208
Output
Yes
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
eSeF
Ldio03