100940: [AtCoder]ABC094 A - Cats and Dogs

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $100$ points

Problem Statement

There are a total of $A + B$ cats and dogs. Among them, $A$ are known to be cats, but the remaining $B$ are not known to be either cats or dogs.

Determine if it is possible that there are exactly $X$ cats among these $A + B$ animals.

Constraints

  • $1 \leq A \leq 100$
  • $1 \leq B \leq 100$
  • $1 \leq X \leq 200$
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

$A$ $B$ $X$

Output

If it is possible that there are exactly $X$ cats, print YES; if it is impossible, print NO.


Sample Input 1

3 5 4

Sample Output 1

YES

If there are one cat and four dogs among the $B = 5$ animals, there are $X = 4$ cats in total.


Sample Input 2

2 2 6

Sample Output 2

NO

Even if all of the $B = 2$ animals are cats, there are less than $X = 6$ cats in total.


Sample Input 3

5 3 2

Sample Output 3

NO

Even if all of the $B = 3$ animals are dogs, there are more than $X = 2$ cats in total.

Input

题意翻译

### 题目描述 猫和狗一共有 $A+B$ 只,其中 $A$ 只是猫,剩下的 $B$ 只不知道是猫还是狗。 请判定这 $A+B$ 只猫和狗中,猫可能正好有 $X$ 只吗。 ### 输入格式 输入以以下形式由标准输入给出。 $ A $ $ B $ $ X $ 输出格式 如果猫正好有 $X$ 只的话就输出 $YES$ ,如果不可能的话就输出 $NO$ 。 #### 说明/提示 限制: $1$ ≤ $A$ ≤ $100$ $1$ ≤ $B$ ≤ $100$ $1$ ≤ $X$ ≤ $200$ 输入为整数 #### 样例 1 $B$ = $5$ 只,如果猫 $1$ 只,狗 $4$ 只,则猫的数量合计为$X$ 只。 #### 样例 2 即使两个不确定的都是猫,猫的数量合计也不足 $X$ 只。 #### 样例 2 即使三个不确定的都是狗,猫的数量合计也会比 $X$ 只多。

加入题单

上一题 下一题 算法标签: