Created
May 3, 2021 12:57
-
-
Save VxDxK/09aff572e38176087dd3c5e0b13da68b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = [[0] * 100 for i in range(100)] | |
for i in range(100): | |
for j in range(100): | |
if i + 1 + j >= 79 or 2 * i + j >= 79 or i + 2 * j >= 79: | |
a[i][j] = 1 | |
for k in range(100): | |
for i in range(1, 100): | |
for j in range(1, 100): | |
if a[i][j] == 0: | |
if a[i + 1][j] > 0 and a[j][i + 1] > 0 and a[i + j][j] > 0 and a[i][j + i] > 0: | |
a[i][j] = -1 * max(a[i + 1][j], a[j][i + 1], a[i + j][j], a[i][j + i]) | |
else: | |
if a[i + 1][j] < 0 or a[j][i + 1] < 0 or a[i + j][j] < 0 or a[i][j + i] < 0: | |
a[i][j] = abs( min(a[i + 1][j], a[j][i + 1], a[i + j][j], a[i][j + i]) ) + 1 | |
#Тут уже собсна ответ выбираем | |
print("Задание 20:", end=" ") | |
for i in range(1, 100): | |
if a[9][i] == 2: | |
print(i, end = " ") | |
print() | |
print("Задание 21:", end=" ") | |
for i in range(1, 100): | |
if a[9][i] == -2: | |
print(i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment