A. Pineapple Incident
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

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.

Input

The first and only line of input contains three integers t, s and x (0 ≤ t, x ≤ 109, 2 ≤ s ≤ 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

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.

Examples
Input
3 10 4
Output
NO
Input
3 10 3
Output
YES
Input
3 8 51
Output
YES
Input
3 8 52
Output
YES
Note

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.

题意: t, t + s, t + s + 1, t + 2s, t + 2s + 1,   给你t,s ,x 判断x是否为序列中的值

题解: 水题也挂终测   靠hack 上分

 #include<bits/stdc++.h>
#define ll __int64
#define mod 1e9+7
#define PI acos(-1.0)
#define bug(x) printf("%%%%%%%%%%%%%",x);
using namespace std;
int t,s,x;
int main()
{
scanf("%d %d %d",&t,&s,&x);
if(t==x)
{
cout<<"YES"<<endl;
return ;
}
if(x<t||x<t+s)
{
cout<<"NO"<<endl;
return ;
}
x=x-t;
if(x%s==||x%s==)
{
cout<<"YES"<<endl;
return ;
}
cout<<"NO"<<endl;
return ;
}

最新文章

  1. DELL PowerEdge 2950更换告警硬盘
  2. 关于sql语句in的使用注意规则
  3. winform保存登录cookie
  4. SQL数据库开发知识总结:提高篇
  5. Unity3d 屏幕空间人体皮肤知觉渲染&amp;次表面散射Screen-Space Perceptual Rendering &amp; Subsurface Scattering of Human Skin
  6. TN2151:崩溃报告
  7. SpringCloud网关ZUUL集成consul
  8. 分布式缓存组件Hazelcast
  9. 【原】无脑操作:HTML5 + CSS + JavaScript实现比赛排程
  10. 团体程序设计天梯赛(CCCC) L3019 代码排版 方法与编译原理密切相关,只有一个测试点段错误
  11. Java——继承的运行顺序
  12. linux &gt; 和 &gt;&gt; 、&lt; 区别
  13. [PHP] 算法-删除链表中重复的结点的PHP实现
  14. jdbc连接 orale 和 mysql 所需要的jar包
  15. 用IBM MQ中间件开发碰到的MQRC_NOT_AUTHORIZED(2035)问题
  16. Debian 中文环境设置
  17. 设计模式(14)--Command(命令模式)--行为型
  18. idea中的maven模块变成灰色的可能原因
  19. Laravel 本地化定义
  20. java程序实现鼠标绘图

热门文章

  1. Java构造方法经典例题
  2. sudo apt-get install ubuntu-desktop, Error: unable to locate package
  3. graphQL 启动报错No method or field found with any of the following signatures (with or without one of [interface graphql.schema.DataFetchingEnvironment] as the last argument), in priority order:
  4. nginx反向代理后端web服务器记录客户端ip地址
  5. 记python版本管理--pyenv
  6. oracle中常用的两个伪列
  7. jupyter notebook(三)&mdash;&mdash;IOPub_data_rate_limit报错
  8. Entrez Direct
  9. 华为liteos了解(一)
  10. A1025 PAT Ranking (25)(25 分)