#给牛客的问题反馈和建议# Python3编译
list1 = input().split(';39;)
x = 0
y = 0
for i in list1:
try:
if i[0] == 'A39;:
x = x + -1 * int(i[1:])
if i[0] == 'D39;:
x = x + 1 * int(i[1:])
if i[0] == 'S39;:
y = y + -1 * int(i[1:])
if i[0] == 'W39;:
y = y + 1 * int(i[1:])
except:
pass
print(str(x)+ ',39; + str(y))
打印无输出,删除或者替换',39;就有输出了
单独打印',39;也有输出
list1 = input().split(';39;)
x = 0
y = 0
for i in list1:
try:
if i[0] == 'A39;:
x = x + -1 * int(i[1:])
if i[0] == 'D39;:
x = x + 1 * int(i[1:])
if i[0] == 'S39;:
y = y + -1 * int(i[1:])
if i[0] == 'W39;:
y = y + 1 * int(i[1:])
except:
pass
print(str(x)+ ',39; + str(y))
打印无输出,删除或者替换',39;就有输出了
单独打印',39;也有输出
全部评论
相关推荐
06-18 20:47
广西大学 单片机 点赞 评论 收藏
分享
07-08 10:34
华中科技大学 机械结构工程师 点赞 评论 收藏
分享