http://e-tutor.itsa.org.tw/e-Tutor/mod/programming/view.php?id=7066
這題然是3*3但輸入資料只有三行每行個別字串切割放入一個大小為九的陣列 最後最排序,取末三個相加
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int arr[] = new int[9], count = 0;
for (int i = 0; i < 3; i++) {
String s[] = scn.next().split(",");
for (int j = 0; j < 3; j++)
arr[count++] = Integer.parseInt(s[j]);
}
Arrays.sort(arr);
System.out.println((arr[8] + arr[7] + arr[6]));
}
/*
題目:[C_AR81-易] 求Array元素最大值的和
作者:1010
時間:西元 2016 年 7 月 */
}