2244.Pineapple Incident

Time Limit: 1s Memory Limit: 256MB

Ted has a pineapple. This pineapple is able to bark like a bulldog! At time t (in seconds) it barks for the first time. Then every s seconds after it, it barks twice with 1 second interval. Thus it barks at times t, t+s, t+s+1, t+2s, t+2s+1, etc.

2244_1.png

Barney woke up in the morning and wants to eat the pineapple, but he can't eat it when it's barking. Barney plans to eat it at time x (in seconds), so he asked you to tell him if it's gonna bark at that time.

Input Format(From the terminal/stdin)

The first and only line of input contains three integers t, s and x (0 \le t,x \le 109, 2 \le s \le 109)- the time the pineapple barks for the first time, the pineapple barking interval, and the time Barney wants to eat the pineapple respectively.

Output Format(To the terminal/stdout)

Print a single "YES" (without quotes) if the pineapple will bark at time x or a single "NO" (without quotes) otherwise in the only line of output.

Sample Input 1

Copy
3 10 4
 ·  · \n

Sample Output 1

Copy
NO
  \n

Sample Input 2

Copy
3 10 3
 ·  · \n

Sample Output 2

Copy
YES
   \n

Sample Input 3

Copy
3 8 51
 · ·  \n

Sample Output 3

Copy
YES
   \n

Sample Input 4

Copy
3 8 52
 · ·  \n

Sample Output 4

Copy
YES
   \n

Hints

In the first and the second sample cases pineapple will bark at moments 3, 13, 14, ..., so it won't bark at the moment 4 and will bark at the moment 3.

In the third and fourth sample cases pineapple will bark at moments 3, 11, 12, 19, 20, 27, 28, 35, 36, 43, 44, 51, 52, 59, ..., so it will bark at both moments 51 and 52.

Submit

请先 登录

© 2025 FAQs