Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
106506 | 糜宗易 | 计算平均数 | C++ | Compile Error | 0 MS | 0 KB | 282 | 2025-01-16 12:07:38 |
#include<bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } int s = 0; for (int i = 0; i < n; i++) { s = s + a[i]; } cout << s << endl; float b = s * 1.0 / n; printf("%.2f\n", b);
Main.cc: In function 'int main()': Main.cc:17:21: error: expected '}' at end of input printf("%.2f\n", b); ^