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: 406 Weeks Ago, 2 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 10.00

planet curvy

On the planet curvy everything is curved. Even light travel in a curve there. They imported a rectangular grid and some very delicious square donuts from nearby planet straighty. The size of grid is m x n and area of a donut is one unit square.

Donuts are placed such that :
For every value of x from 0 to m, a series is created which determines the position of y coordinate on which donut is placed :

Yn = Yn-1 + n

where ,

Yn = y coordinate of current donut.

Yn-1 = y-coordinate of previous donut.

n = number of donut for current series.

Y1 is equal to the x coordinate for that particular series.

for eg x=1 donuts are placed at
Y=1, Y=3, Y=6, Y=10 , …..

For x=2 donuts are placed at:
Y=2, Y=4, Y=7….

Equation of curve of line of sight at position (0,0) is given by:
Y=(x-a)^2

On the day of competition contestant are asked to stand at a position (0,b). Now you have to determine how many donuts does that contestant can see.

Note that since area of donut is 1 unit square, if a donut is placed at (h,k) then is visible from
(x,y) such that : ( ( h - 0.5 )

Input

The first line of the input contains an integer T denoting the number of test cases, each test case contains size of grid (MxN) i.e value of M & N followed by values of a & b.

Output

For each test case, output a single line with number of donuts visible to person.

Constraints

  • 1 = T = 100
  • 1 = M = 200
  • 1 = N = 1000
  • 0 = a = 1000
  • 0 = b = 1000

Example

Input: 2 10 10 1 2 25 50 2 5 Output: 5 14

 

Explanation

Case 1 : for grid 10x10 and person standing at (0,2) , donuts visible to him are at coordinates

(1,1) , (2,2) , (3,3), (3,5) , (4,9)

Case 2 : for grid 25x50 and person standing at (0,5) , donuts visible to him are at coordinates

(1,1) , (1,3), (3,3), (4,4), (4,6), (5,7), (5,10),

(6,15), (6,20), (7,21), (7,27), (8,35), (8,43), (9,44)

Answers

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