A Million Miles
All submissions for this problem are available.
Jack is fond of wandering around his hometown. Everyday he goes for a walk
around his hometown starting from a particular place and ending at another place.
Now let us consider that his hometown's map can be represented in a 2 dimensional plane.
Considering Jack knows from where he will start his walk(coordinates) and where he will
end it(coordinates),he wants to know in how many ways he can reach his destination provided
he follows the following set of rules.
The first rule is that he starts and ends at coordinates
which satisfy reflexive property.
The second rule is that in every step of the walk the Y coordinate must be less than or equal to the X coordinate and he can travel in right,up or down directions only.
The third rule is that in each step he can only travel to integral coordinates i.e no fractional value will be
The first line of the input contains T testcases
. The next T lines contains 4 coordinates (X1,Y1) the starting coordinates and (X2,Y2)the ending coordinates in each of the line
For every test case output a single integral value denoting the maximum number of possible ways
- 1 ≤ T ≤ 100
- -10^6 ≤ (X,Y) ≤ 10^6
- X1 ≤ X2
- Y1 ≤ Y2
Input: 3 1 1 1 1 1 1 2 2 1 1 4 4 Output: 1 1 5
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.