Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 100 点
問題文
数直線上にいるAさんとBさんとCさんがトランシーバーで会話をしようとしています。 Aさんは a [m] 地点、Bさんは b [m] 地点、Cさんは c [m] 地点にいます。 二人の人間は、距離が d [m] 以内のとき直接会話が出来ます。 AさんとCさんが直接的、あるいは間接的に会話ができるか判定してください。 ただしAさんとCさんが間接的に会話ができるとは、AさんとBさんが直接会話でき、かつBさんとCさんが直接会話できることを指します。
制約
- 1 ≤ a,b,c ≤ 100
- 1 ≤ d ≤ 100
- 入力は全て整数
入力
入力は以下の形式で標準入力から与えられる。
a b c d
出力
会話できるなら Yes
を, できないなら No
を出力せよ。
入力例 1
4 7 9 3
出力例 1
Yes
AさんとBさんは直接会話可能です。また、BさんとCさんも直接会話可能です。従って Yes
を出力してください。
入力例 2
100 10 1 2
出力例 2
No
この場合は不可能です。
入力例 3
10 10 10 1
出力例 3
Yes
複数人が同じ場所にいることもあります。
入力例 4
1 100 2 10
出力例 4
Yes
Score : 100 points
Problem Statement
Three people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively. Two people can directly communicate when the distance between them is at most d meters. Determine if A and C can communicate, either directly or indirectly. Here, A and C can indirectly communicate when A and B can directly communicate and also B and C can directly communicate.
Constraints
- 1 ≤ a,b,c ≤ 100
- 1 ≤ d ≤ 100
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
a b c d
Output
If A and C can communicate, print Yes
; if they cannot, print No
.
Sample Input 1
4 7 9 3
Sample Output 1
Yes
A and B can directly communicate, and also B and C can directly communicate, so we should print Yes
.
Sample Input 2
100 10 1 2
Sample Output 2
No
They cannot communicate in this case.
Sample Input 3
10 10 10 1
Sample Output 3
Yes
There can be multiple people at the same position.
Sample Input 4
1 100 2 10
Sample Output 4
Yes