题解 | #坐标移动#

坐标移动

https://www.nowcoder.com/practice/119bcca3befb405fbe58abe9c532eb29

str1 = input()
res = str1.split(";")
dict1 = {}
for i in range(len(res)):
    try:
        mid_num = dict1.get(res[i][0], 0)
        dict1[res[i][0]] = mid_num + int(res[i][1:])
    except:
        continue
print(str(dict1['D'] - dict1['A']) + ',' + str(dict1['W'] - dict1['S']))

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务