a038: Arithmetic Means of Two N×M Dimensional Arrays 兩個N×M維陣列的算術平均
標籤 : Array 陣列
通過比率 : 100% (14 人 / 14 人 ) (非即時)
評分方式 :
Tolerant

最近更新 : 2019-03-01 15:15

內容

Write a program to take the arithmetic means of each pair of values in two N × M dimensional arrays. These calculated means will be outputted into a newly generated N × M dimensional array.

撰寫一個程式,計算兩個N×M維陣列中的每對數值的算術平均,計算出的平均數將輸出到另一個新的N×M維陣列中。

輸入說明

The 1st line contains two integers, N M (1≤N,M≤3). It represents that input data is NxM array.

The following NxM real numbers is array A.

The following NxM real numbers is array B.

For example:

N M
A[0, 0]
A[0, 1]
A[0, 2]

B[0, 0]
B[0, 1]
B[0, 2]

第一行包含兩個整數,N M(1≤N,M≤3)。 它表示輸入數據是NxM陣列。

接著的NxM數字是陣列A.

接著的NxM數字是陣列B.

例如:

N M
A[0, 0]
A[0, 1]
A[0, 2]

B[0, 0]
B[0, 1]
B[0, 2]

輸出說明

A new NxM array whose elements are arithmetic means of array A and array B.

Each line represents a row, and output format for elements is [content].

There is no space between [content] and [content].

There is a blank line after each test case.

※round to one decimal places

一個新的NxM陣列,其元素是陣列A和陣列B的算術平均數。

每行輸出代表陣列的一列,元素的輸出格式為[content]。

[content]和[content]之間沒有空格。

每個測試用例後都有一個空行。

※舍入到小數點後一位

範例輸入
2 2
2 3
7 1
8 7
1 9
範例輸出
[5.0][5.0]
[4.0][5.0]
測資資訊 :
記憶體限制 : 64 MB
隱藏 測資點#0 (20%): 1.0s , <1K
隱藏 測資點#1 (20%): 1.0s , <1K
隱藏 測資點#2 (20%): 1.0s , <1K
隱藏 測資點#3 (20%): 1.0s , <1K
隱藏 測資點#4 (20%): 1.0s , <1K
提示 :

Sample Input:

Sample Output:

2 2
2 3
7 1
8 7
1 9

[5.0][5.0]
[4.0][5.0]
 

3 2
6.5 3
1 2
4 1
1.5 7
9 8
6 7

[4.0][5.0]
[5.0][5.0]
[5.0][4.0]
 

標籤:
Array 陣列
出處:
線上協同學習平臺 - ITSA 教育部資通訊軟體創新人才推升計畫 [編輯 :
zero_jason (zero_jason(MANAGER))
]


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