题解 | #坐标移动#
坐标移动
https://www.nowcoder.com/practice/119bcca3befb405fbe58abe9c532eb29
import re import sys zuobiao=[0,0] for input1 in input().split(";"): if input1[1:].isdigit(): if input1[0]in "AWSD" : if (input1[0]=='A'): zuobiao[0]=int(zuobiao[0])-int(input1[1:]) if (input1[0]=='D'): zuobiao[0]=int(zuobiao[0])+int(input1[1:]) if (input1[0]=='W'): zuobiao[1]=int(zuobiao[1])+int(input1[1:]) if (input1[0]=='S'): zuobiao[1]=int(zuobiao[1])-int(input1[1:]) else: continue # print(zuobiao[0],zuobiao[-1]) zuobiao11=str(zuobiao[0])+","+str(zuobiao[-1]) print(zuobiao11)