Maximum of Integers and Doubles (Function)
Submit solution
Points:
50
Time limit:
1.0s
Memory limit:
10M
Authors:
Problem type
Allowed languages
Java 19
Description
請設計一個 Java 程式,讀入一行數字 (以空格分隔),每個數字可能為整數或小數。
請完成以下要求:
- 判斷每個數字為整數或小數
- 分別使用兩個 function 找出最大值:
- 整數最大值:
findMaxInt(int[] arr, int size) - 小數最大值:
findMaxDouble(double[] arr, int size)
- 整數最大值:
- 輸出整數與小數的最大值,無任何整數或浮點數則輸出
None
Input / Output
| Sample 1 | Sample 2 | Sample 3 | |
|---|---|---|---|
| Input | 1 1.1 2 2.3 5.0 6.7 | 10 3 4.5 10 2.2 8 1.1 | 7.7 2.5 9.9 3.3 |
| Output | 5 6.7 |
10 4.5 |
None 9.9 |
請注意 Sample 1 輸入的 5.0 是整數最大值,會轉換成 5 輸出,因此提示你要統一轉成 Intenger!
Comments