题解 | #坐标移动#
坐标移动
https://www.nowcoder.com/practice/119bcca3befb405fbe58abe9c532eb29?tpId=37&tqId=21240&rp=1&ru=/exam/oj/ta&qru=/exam/oj/ta&sourceUrl=%2Fexam%2Foj%2Fta%3Fdifficulty%3D3%26page%3D1%26pageSize%3D50%26search%3D%26tpId%3D37%26type%3D37&difficulty=3&judgeStatus=undefined&tags=&title=
import sys init = [0, 0] for line in sys.stdin: a = line.split(";") for index in range(0, len(a)): site = a[index] # print(site) if len(site) == 0: continue if len(site) > 3: continue if site[0] not in ["A", "D", "W", "S"]: continue if not site[1:].isdigit(): continue if site[0] == "A": init[0] = init[0] - int(site[1:]) elif site[0] == "D": init[0] = init[0] + int(site[1:]) elif site[0] == "W": init[1] = init[1] + int(site[1:]) elif site[0] == "S": init[1] = init[1] - int(site[1:]) print(",".join(list(map(str, init))))