---
# System prepended metadata

title: Java_Cmoney_ft8105
tags: [Cmoney_Java題目]

---

---
tags: Cmoney_Java題目
---
Java_Cmoney_ft8105
===

![](https://i.imgur.com/qps4oxW.png)
![](https://i.imgur.com/NcbelTm.png)



1.主程式
---
1. 創造一個 `int[3][3]`
2. 用雙重迴圈讀入 9 個數字
3. 用`Arrays.sort()`排序
4. 創造一個 array 來裝 A B C 最大的點數
5. 條件式判斷，贏得條件是比另外兩個點數大
6. 否則就不分勝負

```java=
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[][] arr = new int[3][3];

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                arr[i][j] = sc.nextInt();
            }
            Arrays.sort(arr[i]);
        }
      
        int[] arr2 = {arr[0][2], arr[1][2], arr[2][2]};
      
        if (arr2[0] > arr2[2] && arr2[0] > arr2[1])
            System.out.println("A");
        else if (arr2[1] > arr2[0] && arr2[1] > arr2[2])
            System.out.println("B");
        else if (arr2[2] > arr2[0] && arr2[2] > arr2[1])
            System.out.println("C");
        else
            System.out.println("不分勝負");
    }
}
