题解 | #坐标移动#
坐标移动
http://www.nowcoder.com/practice/119bcca3befb405fbe58abe9c532eb29
while True: try: input_str_list = input().split(";") start_point = [0, 0] for each in input_str_list: if len(each) <= 1: continue if each[0] not in ["A", "S", "W", "D"]: continue char_count = 0 for each_char in each: if each_char.isalpha(): char_count += 1 if char_count > 1: continue if char_count > 1: continue orientation = each[0] num = int(each[1:]) if orientation == "A": start_point[0] = start_point[0] - num elif orientation == "D": start_point[0] = start_point[0] + num elif orientation == "W": start_point[1] = start_point[1] + num elif orientation == "S": start_point[1] = start_point[1] - num else: pass print(str(start_point[0]) + "," + str(start_point[1])) except EOFError: break