Ответ:
import numpy
def func(n,x1,y1,x2,y2):
arr = numpy.zeros(shape=(int(n), int(n)), dtype=int)
num = 0
for x in range(int(n)):
if arr[x-1][0] == 1:
else:
num = 1
for y in range(int(n)):
if num == 0:
arr[x][y] = num
num=1
elif num == 1:
num=0
return 1 if arr[int(y1)][int(x1)] == arr[int(y2)][int(x2)] else 0
print(f"Виведення {func(input('N: '),input('x1: '),input('y1: '),input('x2: '),input('y2: '))}")
Объяснение:
N, x1, y1, x2, y2 = map(int, input().split())
if (x1 + y1) % 2 == (x2 + y2) % 2:
print(1)
print(0)
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
import numpy
def func(n,x1,y1,x2,y2):
arr = numpy.zeros(shape=(int(n), int(n)), dtype=int)
num = 0
for x in range(int(n)):
if arr[x-1][0] == 1:
num = 0
else:
num = 1
for y in range(int(n)):
if num == 0:
arr[x][y] = num
num=1
elif num == 1:
arr[x][y] = num
num=0
return 1 if arr[int(y1)][int(x1)] == arr[int(y2)][int(x2)] else 0
print(f"Виведення {func(input('N: '),input('x1: '),input('y1: '),input('x2: '),input('y2: '))}")
Объяснение:
Verified answer
N, x1, y1, x2, y2 = map(int, input().split())
if (x1 + y1) % 2 == (x2 + y2) % 2:
print(1)
else:
print(0)