Manhattan Distance : Take the sum of the absolute values of the differences of the coordinates.
For example:
PointA = (x1,y1)
PointB = (x2,y2)
Manhattan Distance between PointA and PointB = | x1 - x2 | + | y1 - y2 |
Here | a | is defined as follows-
| a | = \( \begin{cases} a ,& a\gt 0 \\ 0, & a = 0\\ -a, & a\lt 0 \end{cases} \)
Now, You are given a point with integer coordinates A (x,y) and a natural number N you have to find the number of points P such that manhattan distance between point P and point A is exactly N ( Point P should have integer coordinates as well. ).
Input Format: The first line of input will contain three single space seperated integers x , y and N. Where A is point (x,y) and N is manhattan distance.
Output Format: Print a single Integer - the number of points P such that manhattan distance between point P and point A is exactly N
Constraint:
0 <= | x | <= \(10^{18}\)
0 <= | y | <= \(10^{18}\)
1 <= N <= \(10^{18}\)
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
No editorial available for this problem.