arrow_forward
همه ارسالها
جزئیات ارسال کد#700
برای پسندیدن وارد شوید
1n, p = input().split()
2n = int(n)
3p = int(p)
4y, x = input().split()
5x = int(x)
6y = int(y)
7dir = input()
8
9match dir:
10 case "N":
11 y -= p
12 y = y % n
13 case "S":
14 y += p
15 y = y % n
16 case "W":
17 x -= p
18 x = x % n
19 case "E":
20 x += p
21 x = x % n
22 case "NE":
23 x += p
24 x = x % n
25 y -= p
26 y = y % n
27 case "NW":
28 x -= p
29 x = x % n
30 y -= p
31 y = y % n
32 case "SE":
33 x += p
34 x = x % n
35 y += p
36 y = y % n
37 case "SW":
38 x -= p
39 x = x % n
40 y += p
41 y = y % n
42 case _:
43 print("جهت نامعتبر است")
44
45print(f"{y} {x}")
کد ارسالشده برای داوری خودکار هاتکدز
UTF-8