Легко Решено: 0 Процент решений: 0%

Chess Square Color

Determine the color of a square on an 8 by 8 board.

Use a board whose top-left square is white. Rows and columns start at 0 at the top left. Adjacent squares alternate colors. Return empty text for a position outside the board.

Implement chess_square_color(column, row).

Input

column: The column, counted from the left starting at 0.

row: The row, counted from the top starting at 0.

Output

Return white, black, or an empty string for invalid coordinates.

Ограничения

−10 ≤ column, row ≤ 20. Valid board coordinates are 0 through 7.

Примеры

Пример 1
Ввод:
row = 3
column = 2

Ожидаемый вывод:
expected = "black"
Ввод:
long long row = 3;
long long column = 2;

Ожидаемый вывод:
std::string expected = "black";
Ввод:
long row = 3;
long column = 2;

Ожидаемый вывод:
string expected = "black";

Пояснение

Five steps from the white corner change color an odd number of times.

Пример 2
Ввод:
row = 0
column = 8

Ожидаемый вывод:
expected = ""
Ввод:
long long row = 0;
long long column = 8;

Ожидаемый вывод:
std::string expected = "";
Ввод:
long row = 0;
long column = 8;

Ожидаемый вывод:
string expected = "";

Пояснение

Column 8 is outside the valid range 0 through 7.

Ссылки

Это задание адаптировано для CodeUtility. Следуйте условию и ограничениям выше.

Учитесь у других

Решения сообщества

Пока нет опубликованных решений. Решите задание, чтобы поделиться первым.