Destroy the machine
Practice
2.5 (2 votes)
Very Easy
Problem
39% Success 3071 Attempts 10 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Jack has a machine. At time T (in seconds) it runs for the first time. Then every D seconds after it, it runs twice with 1 second interval. Thus it runs at times T, T + D, T + D + 1, T + 2D, T + 2D + 1, etc.

now due to some reasons he wants to destroy the machine but he can not do it in running state of machine Jack plans to destroy it at time x (in seconds), so he asked you to tell him if it's in running state at that time.

Input

  • The first and only line of input contains three integers T, D and x (0≤ T, x ≤ 10^9,2 ≤ D ≤ 10^9) — the time the machine runs for the first time, the machine running interval, and the time at which Jack wants to destroy the machine respectively.

Output

  • Print a single "YES" (without quotes) if the machine is running at time x or a single "NO" (without quotes) otherwise in the only line of output.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:10
79 votes
Tags:
MathematicsBasic MathVery-EasyMathematics
Points:10
10 votes
Tags:
Math BasicAlgorithmsBasic MathMath
Points:10
2 votes
Tags:
Basic ProgrammingBasic MathMathImplementationBasics of ImplementationBasics of Input/Output
Editorial

No editorial available for this problem.