#33515: ○( ^皿^)っ Hehehe…○( ^皿^)っ Hehehe…○( ^皿^)っ Hehehe…


yp11151230@yphs.tp.edu.tw (710-43蔡亞儒)

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

#include <iostream>
#include <iomanip>
using namespace std;
int 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;
  
    }
}

 
#33518: Re: ○( ^皿^)っ Hehehe…○( ^皿^)っ Hehehe…○( ^皿^)っ Hehehe…


yp11151230@yphs.tp.edu.tw (710-43蔡亞儒)

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

#include
#include
using namespace std;
int 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) <  
    }
}



 
ZeroJudge Forum