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 tt + st + s + 1, t + 2st + 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 ts 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.

题解:找规律即可

 1 #include <iostream>
 2 #include <algorithm>
 3 #include <cstring>
 4 #include <cstdio>
 5 #include <vector>
 6 #include <cstdlib>
 7 #include <iomanip>
 8 #include <cmath>
 9 #include <ctime>
10 #include <map>
11 #include <set>
12 using namespace std;
13 #define lowbit(x) (x&(-x))
14 #define max(x,y) (x>y?x:y)
15 #define min(x,y) (x<y?x:y)
16 #define MAX 100000000000000000
17 #define MOD 1000000007
18 #define pi acos(-1.0)
19 #define ei exp(1)
20 #define PI 3.141592653589793238462
21 #define INF 0x3f3f3f3f3f
22 #define mem(a) (memset(a,0,sizeof(a)))
23 typedef long long ll;
24 const int N=1005;
25 const int mod=1e9+7;
26 int main()
27 {
28     int t,s,x;
29     scanf("%d%d%d",&t,&s,&x);
30     if (x==t||(x>=t+s&&(x-t)%s<=1)) printf("YES\n");
31     else printf("NO\n");
32     return 0;
33 }

转载于:https://www.cnblogs.com/shixinzei/p/7262127.html

Codeforce 697A - Pineapple Incident相关推荐

  1. Linux中新建用户用不了sudo命令问题:rootr is not in the sudoers file.This incident will be reported解决

    Linux中新建用户用不了sudo命令问题:rootr is not in the sudoers file.This incident will be reported解决 参考:https://b ...

  2. xxx is not in the sudoers file.This incident will be reported.的解决方法

    xxx is not in the sudoers file.This incident will be reported.的解决方法 参考文章: (1)xxx is not in the sudoe ...

  3. incident用法_“incident、accident、event”,都是“事件”,怎么区分?

    英语学习中,我们总是会遇到各种各样,长得很相似,或者说意思很相似的单词,可它们用法却都不一样.比如说今天办公室同事偶然问到了"accident"和"incident&qu ...

  4. Codeforce 水题报告(2)

    又水了一发Codeforce ,这次继续发发题解顺便给自己PKUSC攒攒人品吧 CodeForces 438C:The Child and Polygon: 描述:给出一个多边形,求三角剖分的方案数( ...

  5. 利用WiFi Pineapple Nano渗透客户端获取SHELL

    前言: 前两篇文章介绍了The WiFi Pineapple Nano设备的一些主要功能模块,例如PineAP.SSLsplit和Ettercap等.今天给大家实际场景演示下如何利用Pineapple ...

  6. How to Fix “Username is not in the sudoers file. This incident will be reported” in Ubuntu

    How to Fix "Username is not in the sudoers file. This incident will be reported" in Ubuntu ...

  7. 记一次SAP开发工程师给微软Azure报incident的体验

    文章标题的incident含义:在企业级软件领域里,当客户使用软件提供商的软件,遇到各种问题或故障,可以使用专门的工具,向软件供应商寻求帮助.我们通常称这种工具创建的帮助请求(Support Requ ...

  8. codeforce 1311 C. Perform the Combo 前缀和

    You want to perform the combo on your opponent in one popular fighting game. The combo is the string ...

  9. oracle u01清理,Oracleの/u01/11g/diag/rdbms/orcl/orcl/incident 的清理

    https://docs.oracle.com/cd/E11882_01/server.112/e25494/diag.htm#ADMIN11007 每当一个错误发生的时候,oracle会创建一个in ...

  10. [已解决]user is not in the sudoers file. This incident will be reported.(简单不容易出错的方式)

    linux Ubuntu中报错,XXX is not in the sudoers file. This incident will be reported. 今天在学习的时候,不小心把自己的用户su ...

最新文章

  1. 可控制的页面内滚动区域
  2. 69道Java Spring 面试笔试题
  3. 一文让你完全弄懂Stegosaurus
  4. 快钱支付与Sql Server的乐观锁和悲观锁
  5. 讲解SQL Server定时作业job的设置方法
  6. 21天Jmeter打卡Day10线程用户之setUp和tearDown
  7. SonicWall远程命令执行漏洞
  8. Vue - 引入集成 Tinymce 富文本编辑器(详细步骤及运行Demo),在 Vue.js 项目中使用富文本插件详细教程,附带超级详细的注释说明
  9. 多频子量子计算机,量子计算机研究:纠错和容错计算
  10. 图书馆管理系统 Java
  11. 的计算机基本操作知识,电脑的基本操作知识有哪些
  12. SOT23(Small Outline Transistor)
  13. 值得关注的5款“企业级低代码开发平台”推荐
  14. 凤凰汽车登陆纳斯达克:累计亏损1820万美元,持续经营能力存疑问
  15. sql创建查询视图语句
  16. 云服务器对比网站,云主机与普通服务器对比
  17. 验证码----svg-captcha
  18. 【JAVA今法修真】 第二章 一气化三清 线程分心念
  19. I won't tell you this is about graph theory----zjfc bellman-ford算法与spfa算法
  20. CSR8675项目实战:BlueEarphone 左右声道各10个Speaker EQ

热门文章

  1. 19春北理工计算机应用基础,19春北理工《计算机应用基础》在线作业(02)【标准答案】.doc...
  2. PHP JAVA BASE64 encode decode
  3. Oracle 常见错误代码处理 1
  4. H5 设备运动事件 DeviceMotionEvent
  5. Java 面试——字符串操作、值传递、重载与重写
  6. vue对象属性为null_如何避免在Vue中使用null作为class的空值
  7. HTML5新规范和CSS3新特性
  8. shop--8.店铺管理页面的开发
  9. JavaScript开发心得--如何传递某行数据给下一页
  10. hibernate Restrictions用法