промежутое
This commit is contained in:
28
programm8.py
Normal file
28
programm8.py
Normal file
@@ -0,0 +1,28 @@
|
||||
f = open('INPUT.TXT')
|
||||
line = f.readline().strip().split()
|
||||
f.close()
|
||||
|
||||
start = line[0]
|
||||
end = line[1]
|
||||
|
||||
start_col = ord(start[0]) - ord('a')
|
||||
start_row = int(start[1]) - 1
|
||||
|
||||
end_col = ord(end[0]) - ord('a')
|
||||
end_row = int(end[1]) - 1
|
||||
|
||||
can_reach = False
|
||||
|
||||
if end_row > start_row:
|
||||
diff_row = end_row - start_row
|
||||
diff_col = abs(end_col - start_col)
|
||||
|
||||
if diff_row == diff_col:
|
||||
can_reach = True
|
||||
|
||||
f = open('OUTPUT.TXT', 'w')
|
||||
if can_reach:
|
||||
f.write('YES')
|
||||
else:
|
||||
f.write('NO')
|
||||
f.close()
|
||||
Reference in New Issue
Block a user