2121 - IP_2020_YOU_LAB4 Scoreboard

Time

2020/10/13 15:30:00 2020/10/13 18:00:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
12903 Card Battle
12904 Tic Tac Toe

12903 - Card Battle   

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:

  1. Use numbers ‘0~32,767’ to represent the cards number.
  2. 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:

  1. Need to have a return value('\n') at the end of your string.
  2. R is a float number which should be rounded to the third decimal place
  3. Unnecessary ‘zero’ digit should not be printed. E.g. (O) 0.25, (X) 0.250.

Sample Input  Download

Sample Output  Download

Tags




Discuss




12904 - Tic Tac Toe   

Description

“Tic Tac Toe” 是一個簡單的雙人對弈遊戲;兩邊玩家依次序分別在3x3的方格場地中畫上圈(O)或叉(X)的符號,直到每一方將自己所屬的符號在場地中連成一線(包含直線、橫線、斜線)

給定一個“Tic Tac Toe”的遊玩結果。請試著判斷該場遊戲是由哪一方獲勝或是和局

 

Note:

  1. 使用 ‘_’ 來代表空格 (意味著雙方都沒有在該格放上旗子)
  2. 使用大寫的 ‘X’ 來代表叉符號
  3. 使用大寫的  來代表圈符號
  4. 每兩個字符中間會有空格將其隔開

Input

一個遊玩的結果

E.g.

O O X

_ X O

X _ X

Output

輸出比須符合以下格式:

M wins!

 

Note:

  1. 輸出的最後必須要有一個換行符號 ('\n')
  2. M 為 ’X’ ‘O’.
  3. 若該場為和局,請輸出“Draw!”

Sample Input  Download

Sample Output  Download

Tags




Discuss