समस्या
अनुवाद दिखाएँ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.
उदाहरण
इनपुट:
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.
इनपुट:
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 के लिए अनुकूलित की गई है। ऊपर दिए गए स्टेटमेंट और सीमाओं का पालन करें।