alanbecker @ 2024-01-28 23:01:04
#include<bits/stdc++.h>
using namespace std;
int main(){
double n,a[100];
double s;
cin >>n;
for(int i = 1;i <= n;i++){
cin >> a[i];
}
for(int i = 1;i <= n;i++){
s += a[i];
}
cout << fixed << setprecision(2) << s / n;
return 0;
}
快救救我这个蒟蒻吧!
by alanbecker @ 2024-01-28 23:02:41
重测一次70?(用的是同一个程序)
by cqbzlzm @ 2024-01-28 23:15:33
数组开小了
#include<bits/stdc++.h>
using namespace std;
int main(){
double n,a[105];
double s;
cin >>n;
for(int i = 1;i <= n;i++){
cin >> a[i];
}
for(int i = 1;i <= n;i++){
s += a[i];
}
cout << fixed << setprecision(2) << s / n;
return 0;
}