As usual, paiza's B rank level up set. It's a problem that the code is officially open to the public.
This time, the problem is almost the same as that of Nezumi Kozo, who was also in the skill check of B rank Hon-chan. It's easy to solve if you don't make a mistake in how the coordinates move when facing either direction.
zahyo_muki.py
x,y,n = [int(i) for i in input().split()]
direction = "N"
for i in range(n):
a = input()
if direction == "N":
if a == "R":
x += 1
direction = "E"
else:
x -= 1
direction = "W"
elif direction == "E":
if a == "R":
y += 1
direction = "S"
else:
y -= 1
direction= "N"
elif direction == "S":
if a == "R":
x -= 1
direction = "W"
else:
x += 1
direction = "E"
else:
if a == "R":
y -= 1
direction = "N"
else:
y += 1
direction = "S"
print(x,y)
nothing special. Forcibly speaking, it was not specified which direction the test case was facing at the initial position, and it was a problem that I had to judge by the output of the test case. I think that B-rank Nezumi Kozo can solve this problem if it is a level that can be solved.
The problem just before this problem (positioning that should be easier than this) was shut out without any hands or feet. .. ..
I just can't put this clockwise movement into the code. For the time being, I escaped from reality and challenged the title problem, but it was too easy to beat. I really don't know. .. .. White flag: bow_tone 4:
Recommended Posts