# | Problem | Pass Rate (passed user / total user) |
---|---|---|
12996 | Reversi |
|
12997 | Two Singly Linked List Comparison |
|
Description
“黑白棋”是一種雙人對弈的棋類遊戲。棋盤共有8行8列共64格。開局時,棋盤正中央的4格先置放黑白相隔的4枚棋子。雙方輪流落子。只要落子和棋盤上任一枚己方的棋子在一條線上(橫、直、斜線皆可)夾著對方棋子,就能將對方的這些棋子轉變為我己方。不能在不能夾住對手的任一顆棋子的地方落子。遊戲在雙方都不能再落子,或棋盤已無空格的情況下結束,子多的一方勝。
給定一個棋局,以及黑方或白方下一個落子的位置,請試著模擬出落子後棋局的變化。
Note:
- 利用字元 ‘_’ 來代表棋盤中的空格
- 利用字元 ‘x’ 來代表棋盤中的黑子
- 利用字元 ‘o’ 來代表棋盤中的白子
- 字元之間存在著空格將其分開
舉例:
- 給定的棋局範例
_ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _
_ _ _ o x _ _ _
_ _ _ x x x _ _
_ _ _ _ x o _ _
_ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _
- 白子落在(5, 3)後的棋局變化
_ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _
_ _ _ o x _ _ _
_ _ _ o x x _ _
_ _ _ o o o _ _
_ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _
Input
一個棋局;一個字元用來表示現在是黑方或白方落子;兩個整數用來表示落子的位置。
Note:
- ‘x’ 表示現在為黑方落子;‘o’ 表示現在為白方落子
- 測資中不會出現不合遊戲規則的落子位置
Output
落子後的棋局
輸出比須符合以下格式:
c c c c c c c c
c c c c c c c c
c c c c c c c c
c c c c c c c c
c c c c c c c c
c c c c c c c c
c c c c c c c c
c c c c c c c c
Note:
- 輸出的最後必須要有一個換行符號 ('\n')
- 字元 c 為 ‘_’、‘x’、‘o’ 中一種
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Given two linked lists. Please Write a C program to compare the data in the nodes of the linked lists to check if they are equal.
function.c
Input
Input follows below format:
len1
n1 n2 n3 n4 ….
len2
m1 m2 m3 m4 ….
Note:
- All len1, len2, n1~ and m1~ are integers. len1 represents the length of the first linked list, also indicates the total number of the data in the next line.
- 32767 >= len1, len2 >= 0.
- 32767 >= n1~, m1~ >= -32768.
Example:
3
1 2 3
4
1 2 3 4
List1: 1 -> 2 -> 3 -> NULL
List2: 1 -> 2 -> 3 -> 4 -> NULL
These two lists have equal data attributes for the first nodes, List2 is longer, though, these lists are not equal.
Output
Output should follow below format:
1(0)
Note:
- Need to have a return value('\n') at the end of your string.
- If two lists are equal, print (“1\n”); otherwise, print(“0\n”).