ZS the Coder is coding on a crazy computer. If you don't type in a word for a cconsecutive seconds, everything you typed disappear!

More formally, if you typed a word at second a and then the next word at second b, then if b - a ≤ c, just the new word is appended to other words on the screen. If b - a > c, then everything on the screen disappears and after that the word you have typed appears on the screen.

For example, if c = 5 and you typed words at seconds 1, 3, 8, 14, 19, 20 then at the second 8 there will be 3 words on the screen. After that, everything disappears at the second 13 because nothing was typed. At the seconds 14 and 19 another two words are typed, and finally, at the second 20, one more word is typed, and a total of 3words remain on the screen.

You're given the times when ZS the Coder typed the words. Determine how many words remain on the screen after he finished typing everything.

Input

The first line contains two integers n and c (1 ≤ n ≤ 100 000, 1 ≤ c ≤ 109) — the number of words ZS the Coder typed and the crazy computer delay respectively.

The next line contains n integers t1, t2, ..., tn (1 ≤ t1 < t2 < ... < tn ≤ 109), where tidenotes the second when ZS the Coder typed the i-th word.

Output

Print a single positive integer, the number of words that remain on the screen after all n words was typed, in other words, at the second tn.

Example

Input
6 5
1 3 8 14 19 20
Output
3
Input
6 1
1 3 5 7 9 10
Output
2

Note

The first sample is already explained in the problem statement.

For the second sample, after typing the first word at the second 1, it disappears because the next word is typed at the second 3 and 3 - 1 > 1. Similarly, only 1 word will remain at the second 9. Then, a word is typed at the second 10, so there will be two words on the screen, as the old word won't disappear because 10 - 9 ≤ 1.


时间间隔超过c就会清除,问最后剩下几个数。

代码:
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;
int main()
{
int n,c;
cin>>n>>c;
int d;
if(n)cin>>d;
int t = d;
int counti = ;
for(int i = ;i < n;i ++)
{
cin>>d;
if(d - t > c)counti = ;
else counti ++;
t = d;
}
cout<<counti;
}

Crazy Computer的更多相关文章

  1. Codeforces 716A Crazy Computer 【模拟】 (Codeforces Round #372 (Div. 2))

    A. Crazy Computer time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...

  2. Codeforces Round #372 (Div. 2) A .Crazy Computer/B. Complete the Word

    Codeforces Round #372 (Div. 2) 不知不觉自己怎么变的这么水了,几百年前做A.B的水平,现在依旧停留在A.B水平.甚至B题还不会做.难道是带着一种功利性的态度患得患失?总共 ...

  3. CodeForces 716A Crazy Computer

    题目链接:http://codeforces.com/problemset/problem/716/A 题目大意: 输入 n c, 第二行 n 个整数,c表示时间间隔 秒. 每个整数代表是第几秒.如果 ...

  4. CF716A Crazy Computer 题解

    Content 有一个电脑,如果过了 \(c\) 秒之后还没有任何打字符的操作,就把屏幕上面所有的字符清空.现在,给定 \(n\) 次打字符的时间 \(t_1,t_2,...,t_n\),求最后屏幕剩 ...

  5. Codeforces Round #370 - #379 (Div. 2)

    题意: 思路: Codeforces Round #370(Solved: 4 out of 5) A - Memory and Crow 题意:有一个序列,然后对每一个进行ai = bi - bi  ...

  6. Codeforces水题集合[14/未完待续]

    Codeforces Round #371 (Div. 2) A. Meeting of Old Friends |B. Filya and Homework A. Meeting of Old Fr ...

  7. Codeforces Round #372 (Div. 2) A

    Description ZS the Coder is coding on a crazy computer. If you don't type in a word for a c consecut ...

  8. Codeforces Round #372 (Div. 2) A B C 水 暴力/模拟 构造

    A. Crazy Computer time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...

  9. Codeforces Round #372 +#373 部分题解

    用了两场比赛上Div 1感觉自己好腊鸡的说...以下是这两场比赛的部分题解(不得不说有个黄学长来抱大腿还是非常爽的) Round #372 : Div 2 A:Crazy Computer 题意:给定 ...

随机推荐

  1. typescripts学习

    可选与默认参数 可选参数:在参数名后面,冒号前面添加一个问号,则表明该参数是可选的.如下代码: function buildName(firstName: string, lastName?: str ...

  2. 个人学期总结及Python+Flask+MysqL的web建设技术过程

    一个学期即将过去,我们也迎来了2018年.这个学期,首次接触了web网站开发建设,不仅是这门课程,还有另外一门用idea的gradle框架来制作网页. 很显然,用python语言的flask框架更加简 ...

  3. memcached set命令的大致处理逻辑笔记

    这次记录状态机的主要逻辑,跟踪set命令的执行流程,暂不涉及到内存申请这一块,下面内容基本都是代码注释 首先还是补充了解下客户连接在发送数据到数据被处理并返回过程中conn的各种状态的表示 enum ...

  4. Redis Commands(1)

    Redis 命令分为15类,如下: Cluster Connection Geo Hashes HyperLogLog Keys Lists Pub/Sub Scripting Server Sets ...

  5. python-day6---流程控制

    # if 条件:# 子代码1# 子代码2# 子代码3 # if True:# print('ok')# print('=====?>')# print('=====?>')# print( ...

  6. Chrome DevTools 的 Sources 调试

    在 Chrome 中调试 JS 代码,那你不得不与 Chrome DevTools 的 Sources 面板打交道,所以文章主要通过介绍 Sources 面板上的各部分功能来介绍如何调试网页中的 JS ...

  7. 无法使用BIPublisher开发报表

    我的机器是windows7,word版本问word 2010 32bit. 以前BIPublisher(安装的是BIPublisher 10.1.33版本)能正常使用,突然有一天再想使用他的时候,报以 ...

  8. ORACLE11G内存管理参数

    今天,对ORACLE11G的几个内存参数看了一下,记录如下,大家可以参考: 1.首先,在ORACLE11G的INIT.ORA里,有“__”开头的参数,也就是以两个下划线开头的参数,这种参数应该是系统自 ...

  9. 用实例说明Spark stage划分原理

    注意:此文的stage划分有错,stage的划分是以shuffle操作作为边界的,可以参考<spark大数据处理技术>第四章page rank例子! 参考:http://litaotao. ...

  10. Openwrt working with patches in the build system (8)

    Reference :https://openwrt.org/docs/guide-developer/build-system/use-patches-with-buildsystem exampl ...