# Пусть белый цвет это false и соответственно черный true
эта функция определяет цвет по ее координатам, которые не больше числа 8
def checkColor(x, y):
assert x <= 8 and y <= 8
color = None
if x % 2 == 0:
if y % 2 == 0:
color = True
else:
color = False
else:
if y % 2 == 0:
color = False
else:
color = True
return color
# Задаем координаты первой и второй позиции
k, l, m, n = map(int, input().split())
if checkColor(k, l) == checkColor(m, n):
print('YES')
else:
print('NO')
Объяснение:
#include <iostream>
int main()
{
using namespace std;
int N;
cout << "Enter N: ";
cin >> N;
int num;
int max = 1;
int i;
for (i = 0; i < N; ++i)
{
cout << "Enter #" << i + 1 << " number: ";
cin >> num;
if ((num - 9) % 10 != 0 && num % 3 == 0)
{
max = num;
break;
}
}
for (int j = i + 1; j < N; ++j)
{
cout << "Enter #" << j + 1 << " number: ";
cin >> num;
if ((num - 9) % 10 != 0 && num % 3 == 0)
if (num > max)
max = num;
}
if (max != 1)
cout << "Max number div by 3 and don't end 9: " << max << endl;
else
cout << "No numbers div by 3 and don't end 9" << endl;
return 0;
}