#K79902. Robot Vacuum Cleaner Maximum Cleaned Cells
Robot Vacuum Cleaner Maximum Cleaned Cells
Robot Vacuum Cleaner Maximum Cleaned Cells
Problem Statement:
A robot vacuum cleaner is placed on an infinite grid at a starting position \( (x, y) \) with an initial battery life of \( b \) moves. Each move allows the vacuum cleaner to move to an adjacent cell (up, down, left, or right), cleaning the cell as it goes. Note that the vacuum cleaner cleans the cell where it initially starts, and it cannot clean the same cell more than once.
It turns out that the maximum number of unique cells the robot can clean is given by the formula \( (b+1)^2 \). Your task is to implement a program that computes this number given the starting position and the battery life.
Input: Three integers \( x \), \( y \), and \( b \) where \( -10^9 \leq x, y \leq 10^9 \) and \( 0 \leq b \leq 10^5 \).
Output: A single integer representing the maximum number of unique cells the robot vacuum cleaner can clean. The answer is computed by the formula:
\[ (b+1)^2 \]inputFormat
The input is read from standard input (stdin) and consists of a single line containing three space-separated integers. These integers are:
x
: the starting x-coordinate of the robot.y
: the starting y-coordinate of the robot.b
: the battery life (number of moves available).
outputFormat
Print to standard output (stdout) a single integer representing the maximum number of unique cells that the robot vacuum cleaner can clean. The result is computed as:
\[ (b+1)^2 \] ## sample0 0 5
36