Not So Tough!
Practice
0 (0 votes)
Easy
Problem
48% Success 47 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

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 ( 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

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
25 votes
Tags:
Binary SearchMath BasicAlgorithmsBasic MathMath
Points:20
432 votes
Tags:
Ad-HocEasyMath
Points:20
1 votes
Editorial

No editorial available for this problem.