Professor Santos has decided to hide a secret formula for a new type of biofuel. She has, however, left a sequence of coded instructions for her assistant. Each instruction is a sequence of five digits which represents a direction to turn and the number of steps to take.
The first two digits represent the direction to turn:
• If their sum is odd, then the direction to turn is left.
• If their sum is even and not zero, then the direction to turn is right.
• If their sum is zero, then the direction to turn is the same as the previous instruction.
The remaining three digits represent the number of steps to take which will always be at least 100.
Your job is to decode the instructions so the assistant can use them to find the secret formula.
桑托斯教授决定隐藏一种新型生物燃料的秘密配方。然而,她为她的助手留下了一系列编码指令。
每条指令是一个由五位数字组成的序列,代表要转的方向和要走的步数。
前两位数字代表转向的方向:
如果它们的和是奇数,那么转向方向是左。
如果它们的和是偶数且不为零,则转向方向是右。
如果它们的和为零,那么转向方向与上一条指令相同。
剩下的三位数字代表要走的步数,这个数字总是至少100。
你的工作是解码指令,以便助手可以使用它们找到秘密配方。