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: 307 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 16 Sep 2017 My Price 9.00

position and velocity

N cars are racing on a straight road. You are given their position and velocity at time t = 0. Each car is moving in the same direction with a constant positive velocity. Find the number of overtakes that take place in the race, if the race ends at time t = T0.

A car A is said to have overtaken a car B if there exists a time t0 such that car A was strictly behind car B for time 0 0 but is strictly ahead of car B for time T0 >= t > t0

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 denoting the number of cars and T0 denoting the race end time. In the next N lines, each contain two space separated integers: Xi and Vi, denoting the ith car's starting position and velocity respectively.

Output

  • For each test case, output a single line containing the number of overtakes that take place.

Constraints

  • 1 = T = 10
  • 1 = N = 105
  • 1 = T0, Xi, Vi = 109

Example

Input: 2 3 5 1 3 2 2 1 1 4 2 1 2 1 4 2 2 4 1 Output: 1 2

Explanation

Example case 1. The first car will overtake the second car at time 1.

Example case 2. The second car will overtake the third car at time 0.5 and the second car will overtake the fourth car at time 1. We count these towards the answer. The first car overtakes the fourth car at time 3 and the third car overtakes the fourth car at time 2. We do not count these towards the answer.

Answers

(5)
Status NEW Posted 16 Sep 2017 01:09 PM 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)