Hello,
I do not understand what was my mistake for the overexcited fan problem.
Is it possible to have the test set input 1 now that the challenge is over ?
My strategy was to move east until I will be on the same vertical axis that
the goal and then wait if the next step of the goal would be on my position
or move north/South to get closer…
Thank you
My code :
T = int(input())
for case in range(1, T + 1):
entree = input().split(" ")
dx = int(entree[0])
dy = int(entree[1])
path = entree[2]
time = 0
for i in range(len(path)):
#first to the east
if dx != 0:
if path[i] == 'S':
dy -= 1
elif path[i] == 'N':
dy += 1
dx -= 1
time += 1
#then to the north or the south
elif dy != 0:
time = time + 1
nextdy = dy
if path[i] == 'S':
nextdy -= 1
dy -= 2
elif path[i] == 'N':
nextdy += 1
if nextdy == 0:
dy = 0
break
elif dx == 0 and dy == 0:
break
if (dx == 0 and dy == 0):
print("Case #%i: %s" % (case, time))
if dx != 0 or dy != 0:
print("Case #%i: %s" % (case, "IMPOSSIBLE"))
--
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-code/e4ea8d97-fa8d-437b-a422-72af4f2c5d6b%40googlegroups.com.