CF697A.Pineapple Incident

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 + 2_s_, t + 2_s_ + 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.

泰德有一个菠萝。这个菠萝能像斗牛犬一样吠叫!它在时刻 tt(单位:秒)第一次吠叫。此后,每隔 ss 秒,它会连续吠叫两次,且这两次吠叫之间间隔 1 秒。因此,它的吠叫时刻依次为 tt、t+st + s、t+s+1t + s + 1、t+2st + 2s、t+2s+1t + 2s + 1,依此类推。

巴尼早上醒来,想吃掉这个菠萝,但他不能在菠萝吠叫时吃它。巴尼计划在时刻 xx(单位:秒)吃掉菠萝,因此他请你告诉他:在该时刻菠萝是否会吠叫。

输入格式

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.

输入仅有一行,包含三个整数 tt、ss 和 xx(0 ≤ t, x ≤ 1090 ≤ t, x ≤ 10^9,2 ≤ s ≤ 1092 ≤ s ≤ 10^9),分别表示菠萝第一次鸣叫的时间、菠萝鸣叫的时间间隔,以及巴尼想要吃菠萝的时间。

输出格式

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.

如果菠萝在时刻 x 会吠叫,则在输出的唯一一行中打印一个单独的 "YES"(不带引号);否则打印一个单独的 "NO"(不带引号)。

输入输出样例

  • 输入#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.

在第一和第二个样例中,菠萝将在时刻 3、13、14、… 吠叫,因此它不会在时刻 4 吠叫,但会在时刻 3 吠叫。

在第三和第四个样例中,菠萝将在时刻 3、11、12、19、20、27、28、35、36、43、44、51、52、59、… 吠叫,因此它会在时刻 51 和 52 均吠叫。

输入解题思路,AI测评打分。不知道怎么写?

首页