#33517: C++ ANS


yp11151097@yphs.tp.edu.tw (808-30施耀登)

學校 : 臺北市私立延平高級中學
編號 : 197083
來源 : [203.72.178.1]
最後登入時間 :
2023-06-09 13:54:26
d786. 三、平均值 -- 99學年度板橋高中校內資訊學科能力競賽 | From: [203.72.178.1] | 發表日期 : 2023-01-11 17:29

#include<bits/stdc++.h>
using namespace std;
main(){
int t; cin>>t;
for(int i=1;i<=t;i++){
    double sum=0;
    int n; cin>>n;
    for(int j=1;j<=n;j++){
        int p; cin>>p;
        sum+=p;
    }
    double ave=sum/n;
    cout<<fixed<<setprecision(2)<<ave<<endl;
}
}

 
ZeroJudge Forum