#C10918. Drone Energy Calculation
Drone Energy Calculation
Drone Energy Calculation
You are given the coordinates of a starting point and a destination in a 3-dimensional space. A drone must move from the starting point to the destination while carrying a cargo box. The energy consumed by the drone is equal to the Manhattan distance between the two points. In other words, if the starting point is \((x_1, y_1, z_1)\) and the destination is \((x_2, y_2, z_2)\), then the energy required is given by:
\[ E = |x_2 - x_1| + |y_2 - y_1| + |z_2 - z_1|\]Your task is to compute and output this minimum energy.
inputFormat
The input consists of six integers separated by spaces: x1 y1 z1 x2 y2 z2
, where \( (x1, y1, z1) \) represents the starting coordinates and \( (x2, y2, z2) \) represents the destination coordinates.
outputFormat
Output a single integer: the minimum energy required by the drone to move from the start to the destination.
## sample0 0 0 1 2 3
6