ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1140. Swamp Incident

Some hints for you !
Posted by Phan Hoài Nam (Harvey Nash) 9 Feb 2011 09:39
- Calculate the x y coordinates of the student
- Find the X, Y or Z axis nearest to the student (the axis that the student can go on it with least step).
- Calculate the number of steps to nearest axis + the number of steps from new place in nearest axis to central cell.

Note:
On X axis : x = 0
On Y axis : x = y
On Z axis : x = -y
Least steps to X: x + step * xDir = 0                   => step = ?
Least steps to Y: x + step * xDir = y + step * yDir     => step = ?
Least steps to Z: x + step * xDir = - (y + step * yDir) => step = ?

Of which:
X axis : (xDir, yDir) = (0,2)
Y axis : (xDir, yDir) = (1,1)
Z axis : (xDir, yDir) = (1,-1)

Chúc các bạn may mắn :)

Edited by author 09.02.2011 09:40

Edited by author 09.02.2011 09:41