No.998 Four Integers
タグ : / 解いたユーザー数 613
作問者 :
tsutaj
/ テスター :
tempura_pp
Problem Statement
You are given $4$ non-negative integers $A, B, C, D$. Determine whether they can be rearranged to form $4$ consecutive integers.
Here, $4$ integers $X < Y < Z < W$ are said to be "consecutive" if $Y = X+1, Z = Y+1, W = Z+1$ all hold.
Input
$A$ $B$ $C$ $D$
- All inputs are given as integers.
- $0 \leq A, B, C, D \leq 100$
Output
If the given $4$ integers can be rearranged to form $4$ consecutive integers, print Yes. Otherwise, print No.
Do not forget to print a newline at the end of the output.
Sample
Sample 1
Input
3 1 2 4
Output
Yes
The input can be rearranged into 1 2 3 4, which are $4$ consecutive integers.
Sample 2
Input
0 2 2 4
Output
No
No matter how they are rearranged, they cannot form $4$ consecutive integers.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。