largest in diagonal line
Submit solution
Points:
10 (partial)
Time limit:
1.0s
Memory limit:
256M
Authors:
Problem type
Allowed languages
Java 19, Java 8
題目說明
程式輸入正方形的二維陣列,找出兩條對角線上的最大數字。
輸入格式
陣列的橫列數量、陣列的直行數量、恰好可以填滿陣列的所有元素(從第一列到最後一列,每一列從第一行到最後一行)
輸入值範圍
橫列數量等於直行數量,且行列數量都是大於等於1的奇數。除此之外,所有數字都是大於等於0且小於等於1000的整數。
輸出
題目指定的最大數字
sample input1
3 3 1 6 5 8 3 7 2 9 4
sample output1
5
說明
1 6 5
8 3 7
2 9 4
因為以上陣列的對角線是1 3 4和5 3 2,所以最大值是5
sample input2
5 5 1 6 5 8 3 7 2 9 4 2 3 7 2 9 2 2 3 2 4 0 4 2 9 2 7
sample output2
7
Comments