Finding Bruce




Finding Bruce


Bruce likes to wander around his garden while contemplating important and difficult problems. Unfortunately an emergency has arisen and the government needs to find Bruce immediately so that he can help them resolve it. They don’t know where he is; they only know how long he has been walking. Fortunately, Bruce wanders very predictably.

Bruce’s garden is an infinite plane divided into a grid of squares. He always starts the first second of his walk in the lower left corner of the grid, (1, 1), and the plane extends arbitrarily far up and to the right. Bruce then moves in a particular pattern, moving one square per second. He starts by moving up one square, then one square to the right, and then down one square. He then moves one square to the right, up two squares, and left two squares. This is followed by moving up one square, then right three squares, and down three squares, and so forth. The grid below shows the path he travels, with the number at each grid location being the time at which he is at that location.







...





10
11
12
13


9
8
7
14


2
3
6
15


1
4
5
16
...


Given the number of seconds Bruce has been walking in his garden, the government would like you to tell them at exactly what position Bruce is on the grid so that they can pick him up.

Example
From the grid above you can see that, for example, after 6 seconds of walking Bruce is at position (3, 2) and after 8 seconds he is at position (2, 3).
Related image
Given the scenario:
After 28 seconds of walking, Bruce is at position ______. (Type in the numbers separated by a space in the below textbox Example : 2 5).

ANSWER : 4 2

No comments: