?給定一組數據,每個數據都有一定權重,請寫算法計算中位數數值[1.2,1.1,1.8,1.35,1.2,1.4,1.1]權重[1.2,2.1,1.4,2.13,2.1,0.5,1.2]?(String[]?args)?{
????[]?arr1?=?{}[]?arr2?=?{}[]?res?=?[arr1.](i?=?i?<?arr1.i++)?{
????????res[i]?=?arr1[i]?*?arr2[i]}
????Arrays.(res)Arrays.(res).forEach(System.::println)len?=?res.(len?%?!=?)?{
????????System..println(+?res[len?/?])}?{
????????midL?=?res[len?/?-?]midR?=?res[len?/?]System..println(+?(midL?+?midR)?/?)}
}麻煩幫我看看這樣寫對不對
添加回答
舉報
0/150
提交
取消