-
Notifications
You must be signed in to change notification settings - Fork 0
/
1197.py
42 lines (31 loc) · 867 Bytes
/
1197.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
# 1197. Один в поле воин
tests_amount = int(input())
list_result = []
while tests_amount > 0:
input_data = input()
letter = input_data[:1]
num = int(input_data[1:])
result = 8
if letter in ('b', 'g'):
result = result - 2
if letter in ('a', 'h'):
result = result - 4
if result > 6:
if num in (2, 7):
result = result - 2
if num in (1, 8):
result = result - 4
elif result > 4:
if num in (2, 7):
result = result - 2
if num in (1, 8):
result = result - 3
elif result <= 4:
if num in (2, 7):
result = result - 1
if num in (1, 8):
result = result - 2
list_result.append(result)
tests_amount = tests_amount - 1
for i in range(len(list_result)):
print(list_result[i])