题解 | #坐标移动#

坐标移动

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

a = 0
b = 0
c = input().split(';')
for item in c:
    if item[1:].isdigit():
        if item[0] == 'A':
            a -= int(item[1:])
        elif item[0] == 'D':
            a += int(item[1:])
        elif item[0] == 'W':
            b += int(item[1:])
        elif item[0] == 'S':
            b -= int(item[1:])
print(str(a)+','+str(b))
全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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