Maurice Tutor

(5)

$15/per page/Negotiable

About Maurice Tutor

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Algebra,Applied Sciences See all
Algebra,Applied Sciences,Biology,Calculus,Chemistry,Economics,English,Essay writing,Geography,Geology,Health & Medical,Physics,Science Hide all
Teaching Since: May 2017
Last Sign in: 398 Weeks Ago, 5 Days Ago
Questions Answered: 66690
Tutorials Posted: 66688

Education

  • MCS,PHD
    Argosy University/ Phoniex University/
    Nov-2005 - Oct-2011

Experience

  • Professor
    Phoniex University
    Oct-2001 - Nov-2016

Category > Computer Science Posted 17 Sep 2017 My Price 9.00

Hogwarts School of Witchcraft

Recently, Hogwarts School of Witchcraft and Wizardry has introduced a course on coumputer programming! As a result, many programming duels now take place in Hogwarts. Lucius Malfoy has challenged Harry Potter to one such programming duel.

The rules of the duel are as follows:

1) Malfoy chooses two integers N(>0) and K(>=0) and a sequence S of N positive integers.

2) Harry must find the number of distinct non-empty subsequences L of S such that no two integers in L have an absolute difference greater than K.

Since this number may be very large, Harry must report this number modulo (10^9+7).

Input

Input will begin with an integer T, the total number of test cases. Description of T test cases follows.

Each test case is described by two lines of input.

The first line of each test case will consist of two space-seperated integers : N,K.

The second line will contain N space seperated integers : S[1],S[2], ... S[N].

Output

For each test case output a single integer : The number that Harry must report to Malfoy.

Constraints

1 T

1 N

0 K

1 S[i]

Example

Input: 2 3 1 10 11 12 5 6 12 27 1 13 14 Output: 5 9

Explanation

CASE 1 : Possible subsequences : (10), (11), (12), (10,11), (11,12).

CASE 2 : Possible subsequences : (12), (27), (1), (13), (14), (12,13), (12,14), (13,14), (12,13,14).

Answers

(5)
Status NEW Posted 17 Sep 2017 05:09 AM My Price 9.00

Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll

Not Rated(0)