60分的代码,还请 @root 及各位大佬查错(debug)
#include <bits/stdc++.h>
using namespace std;
int n, m;
float sum;
int main() {
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> m;
sum += m;
}
cout << fixed << setprecision(4) << sum / n;
return 0;
}
共 2 条回复
谢谢
用 double, float 精度不够