题解 | #坐标移动#
坐标移动
https://www.nowcoder.com/practice/119bcca3befb405fbe58abe9c532eb29
while 1: try: input_str = input().split(";") # 先剔除不符合要求的 num_list = [] for i in input_str: if i[1:].isdigit() and i[0].isalpha(): num_list.append(i) # x = 0 y = 0 for k in num_list: if k[0] == "A": x -= int(k[1:]) elif k[0] == "D": x += int(k[1:]) elif k[0] == "W": y += int(k[1:]) elif k[0] == "S": y -= int(k[1:]) print(x, end=",") print(y) except: break#悬赏#