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, 4 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 7.00

noted down the co-ordinates

Andromeda has a deep interest in stars, galaxies and the universe since childhood. She has taken several picture of the night sky and based on that, she has noted down the co-ordinates of all the stars in 3D space (the coordinate values are in light years). The coordinates of two stars may not be distinct due to human error. She considers two stars to be in same galaxy if euclidiean distance between them is atmost d light years. Three stars A, B, C such that euclidiean distance between A and B is less than or equal to d and euclidiean distance between B and C is less than or equal to d, then they all will be in same galaxy even if euclidiean distance between A and C is greater than d.

 

Andromeda wants to know the number of galaxies and for that she needs your help. You are given coordinates of N stars and the value of d. You have to tell her the number of galaxies.

 

 

Input

 

  • The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
  • The first line of each test case contains two space separated integers N and d.
  • The next N line contains 3 space-separated xi, yi, zi integers denoting the co-ordinates of the stars

 

 

Output

 

  • For each test case, output a single line containing total number of galaxies.

 

 

Constraints

 

  • 1 = T = 100
  • 1 = N = 100
  • 0 = d = 109
  • -108 = xi, yi, zi = 108 (1 = i = N)

 

 

Example

Input: 1 3 5 0 0 1 0 0 3 0 0 10 Output: 2

Answers

(5)
Status NEW Posted 17 Sep 2017 12:09 PM My Price 7.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)