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