Bounding Robots

Question

Solution

Idea

This is a pretty good question to practice the introductory decomposition skills. This problem can be divided into two solvable smaller parts.

1

Calculate the "Robot Thinking" Coordinates

This is quite simple, just add the input distance (should be properly converted to include the negative number) to the x- and y-coordinate.

2

Calculate the Actual Coordinates

This should be done "step-by-step", which means once you give an input, you calculate the actual coordinates.

And the actual coordinates should be within the bound.

Code

https://github.com/mendax1234/Coding-Problems/blob/main/kattis/boundingrobots/boundingrobots.c

Last updated