a037: Find Largest Value and Smallest Value 尋找最大和最小的值
標籤 : Array 陣列
通過比率 : 100% (31 人 / 31 人 ) (非即時)
評分方式 :
Tolerant

最近更新 : 2019-02-27 10:38

內容

This problem is that find and display the largest value and the smallest value from tester input.
Tester defines N=10 values from input data and store it in array array[]. To find the largest value and smallest value, the first two values of array are checked and largest of these two values is placed in array[0].
Then, the first and third values are checked and largest of these two values is placed in array[0]. This process continues until and first and last values are checked. After this process, the largest value of an array will be in array[0] position. All checked after, to printed the largest value.
Then checked smallest value, the first and third values are checked and smallest of these two value is placed in array[0]. This process continues until and first and last values are checked. The smallest value of array[] position will be printed.
The number is limit between -100 and 100.

這個問題是找到並顯示測試輸入的最大值和最小值。
測試輸入資料定義N = 10個值並將其存儲在陣列array[]中。 為了找到最大值和最小值,檢查陣列的前兩個值,並將這兩個值中的最大值放在array[0]中。
然後,檢查第一個和第三個值,並將這兩個值中的最大值放在array[0]中。 此過程將繼續,直到檢查第一個和最後一個值。 在此過程之後,陣列的最大值將位於array[0]位置。 全部檢查後,輸出最大值。
然後檢查最小值,檢查第一個和第三個值,並將這兩個值中的最小值放在array[0]中。 此過程將繼續,直到檢查第一個和最後一個值。 輸出array[]位置的最小值。
數字限制在-100和100之間。

輸入說明

Tester need to input 10 data, as 56, 8, -6, -78, 88, 14, 35, 46, 25, 10 。

測試需要輸入10個數據,如56, 8, -6, -78, 88, 14, 35, 46, 25, 10。

輸出說明

Largest number = 88
Smallest number = -78

範例輸入
56 
8 
-6 
-78 
88 
14 
35 
46 
25 
10
範例輸出
Largest number = 88 
Smallest number = -78
測資資訊 :
記憶體限制 : 64 MB
隱藏 測資點#0 (50%): 1.0s , <1K
隱藏 測資點#1 (50%): 1.0s , <1K
提示 :
標籤:
Array 陣列
出處:
線上協同學習平臺 - ITSA 教育部資通訊軟體創新人才推升計畫 [編輯 :
zero_jason (zero_jason(MANAGER))
]


編號 身分 題目 主題 人氣 發表日期
沒有發現任何「解題報告」