The Manhattan Distance between two points (a, b) and (c, d) is given by |a−c|+|b−d|, where |u−v| refers to the absolute value of (u−v).
Given an integer S, your task is to find the number of points (x, y), where both x and y are integers, such that the Manhattan Distance between (x, y) and (0,0) is at most S.
For example, suppose S= 1. The only point whose Manhattan Distance from (0,0) is exactly 0 is (0,0). The set of points whose Manhattan Distance from (0,0) is exactly 1 is {1,0),(0,1),(−1,0),(0,−1)}. Thus, there are 5 points whose Manhattan Distance from (0,0) is at most 1, and so the answer for S= 1 is 5.
Find the number of points whose Manhattan Distance from (0,0) is at most S for the following values of S:
(a) S= 4, (b) S= 10, (c) S= 23
logic? Or withproblem-solving? – José Carlos Santos Oct 14 '20 at 06:52