题解 | #坐标移动#

坐标移动

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

str = input().split(';') x,y = 0,0 for i in range(len(str)): str1 = str[i] if (str1.count('A') == 1 or str1.count('D') == 1 or str1.count('W') == 1 or str1.count('S') == 1): if len(str1) == 2: if 'A' in str1: x -= int(str1[1]) if 'D' in str1: x += int(str1[1]) if 'W' in str1: y += int(str1[1]) if 'S' in str1: y -= int(str1[1]) if len(str1) == 3: if 'A' in str1: x -= int(str1[1:]) if 'D' in str1: x += int(str1[1:]) if 'W' in str1: y += int(str1[1:]) if 'S' in str1: y -= int(str1[1:]) print("{},{}".format(x,y))

全部评论

相关推荐

05-03 12:45
西南大学 Java
nsnzkv:你这项目写的内容太多了,说实话都是在给自己挖坑,就算简历过了,后面面试也难受
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务