| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 12903 | Card Battle |
|
| 12904 | Tic Tac Toe |
|
Description
9 cards are placed face down into a 3 by 3 square. Every card has a unique number. Two Players take turns to flip cards, the one gets the higher card win.
Given a table of how these cards are distributed, and which card the first player picked. Please write a C program to tell the first player’s win rate
Hint: win rate = (how many cards smaller than the first card number) / (9 – 1)
Note:
- Use numbers ‘0~32,767’ to represent the cards number.
- Have a ‘Space’ between any two numbers.
Input
A map with all nine cards are placed, and two integers X, Y that represents which card the first player picked.

Output
Output should follow below format:
R
Note that:
- Need to have a return value('\n') at the end of your string.
- R is a float number which should be rounded to the third decimal place
- Unnecessary ‘zero’ digit should not be printed. E.g. (O) 0.25, (X) 0.250.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
“Tic Tac Toe” 是一個簡單的雙人對弈遊戲;兩邊玩家依次序分別在3x3的方格場地中畫上圈(O)或叉(X)的符號,直到每一方將自己所屬的符號在場地中連成一線(包含直線、橫線、斜線)
給定一個“Tic Tac Toe”的遊玩結果。請試著判斷該場遊戲是由哪一方獲勝或是和局
Note:
- 使用 ‘_’ 來代表空格 (意味著雙方都沒有在該格放上旗子)
- 使用大寫的 ‘X’ 來代表叉符號
- 使用大寫的 ‘O’ 來代表圈符號
- 每兩個字符中間會有空格將其隔開
Input
一個遊玩的結果
E.g.
O O X
_ X O
X _ X
Output
輸出比須符合以下格式:
M wins!
Note:
- 輸出的最後必須要有一個換行符號 ('\n')
- M 為 ’X’ 或 ‘O’.
- 若該場為和局,請輸出“Draw!”