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. 丑数问题 Ugly Number

    2018-07-28 15:30:21 一.判断是否为丑数 问题描述: 问题求解: 所谓丑数,首先得是正数,然后其质数因子只包含了2,3,4,因此我们只需要对当前的数分别除2,3,4直到不能除为止. ...

  2. spoj The Next Palindrome

    题意:比给出的数大的最小回文数. 先用前n/2长对称到后面,如果没变大,在中间加1,进位,再对称. //#pragma comment(linker,"/STACK:1024000000,1 ...

  3. 3 python 基本数据类型

    1.python的基本数据类型 1.字符串 不可变数据类型 2.int //整除 %取余 bit_length() print(a.bit_length()) #打印某个数字类型的二进制长度 3.bo ...

  4. Linux中su、su -和sudo的区别

    su 切换到root用户,但是并没有转到root用户家目录下,即没有改变用户的环境. su - 切换到root用户,并转到root用户的家目录下,即改变到了root用户的环境. 这个涉及到不同用户下的 ...

  5. linux--多进程进行文件拷贝

    学习IO的时候,我们都曾经利用文件IO函数,标准IO函数都实现了对文件的拷贝, 对某一个文件进行拷贝时,我们可以考虑一下几种方式: a.单进程拷贝: 假设某一文件需要拷贝100字节,每一个时间片可以完 ...

  6. C# / .NET 在类中使用Server.MapPath

    直接在类中使用 Server.MapPath 会出现错误,这是由于类中不能直接使用 System.Web.UI.Page 的非静态函数造成的.解决方法有两种: 方法一.使类继承System.Web.U ...

  7. splunk LB和scale(根本在于分布式扩展index,search)

    Forwarder deployment topologies You can deploy forwarders in a wide variety of scenarios. This topic ...

  8. ES curl bulk 导入数据

    比如我们现在有这样一个文件,data.json: { " } } { "field1" : "value1" } 它的第一行定义了_index,_ty ...

  9. Openwrt Udev Configure(3)

    1      Scope of Document This document describes how to write udev script, when enum usb device mayb ...

  10. Saiku_学习_01_saiku安装与运行

    一.下载saiku 1.下载地址 官网:https://community.meteorite.bi/ 2.解压后文件结构 3.ROOT和saiku 在tomcat/webapp 下有两个web应用, ...