-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path坐标移动.py
47 lines (43 loc) · 1.24 KB
/
坐标移动.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/9/4 20:22
# @Author : SeniorZhu1994
# @Email : SeniorZhu1994@
# @Site :
# @File : 坐标移动.py
# @Software: PyCharm
# @Describe:
if __name__ == '__main__':
while True:
try:
x = 0
y = 0
ls = input().split(';')
for i in range(len(ls)):
if 'A' in ls[i]:
try:
num_left = int(ls[i][1:])
x -=num_left
except:
pass
elif 'S' in ls[i]:
try:
num_down = int(ls[i][1:])
y -= num_down
except:
pass
elif 'D' in ls[i]:
try:
num_right = int(ls[i][1:])
x += num_right
except:
pass
elif 'W' in ls[i]:
try:
num_up = int(ls[i][1:])
y += num_up
except:
pass
print(str(x) + ',' + str(y))
except:
break