题解 | #坐标移动#
坐标移动
https://www.nowcoder.com/practice/119bcca3befb405fbe58abe9c532eb29
import sys
s = ""
for line in sys.stdin:
a = line.split()
s = a[0]
l = s.split(";")
point = [0, 0]
for i in l:
if not i:
continue
elif i[0] == "X":
continue
elif len(i)>3:
continue
elif i[0]=="A" and i[1:].isdigit():
point[0] = point[0] - int(i[1:])
elif i[0]=="D" and i[1:].isdigit():
point[0] = point[0] + int(i[1:])
elif i[0]=="W" and i[1:].isdigit():
point[1] = point[1] + int(i[1:])
elif i[0]=="S" and i[1:].isdigit():
point[1] = point[1] - int(i[1:])
else:
continue
print(str(point[0])+","+str(point[1]))
