A10544 | Pineapple Incident
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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.
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.
输入格式
The first and only line of input contains three integers $t$ , $s$ and $x$ ( $0<=t,x<=10^{9}$ , $2<=s<=10^{9}$ ) — the time the pineapple barks for the first time, the pineapple barking interval, and the time Barney wants to eat the pineapple respectively.
输出格式
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.
输入输出样例
输入 #1
3 10 4
输出 #1
NO
输入 #2
3 10 3
输出 #2
YES
输入 #3
3 8 51
输出 #3
YES
输入 #4
3 8 52
输出 #4
YES
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$ .
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$ .
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted