Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
136259 彭士宝 18统计成绩 Python3 Compile Error 0 MS 0 KB 1007 2025-11-09 22:49:42

Tests(0/0):


Code:

#include <iostream> #include <iomanip> // 用于控制输出格式 using namespace std; int main() { int n; cin >> n; // 输入学生人数 if (n <= 0) { cout << "0 0.00 0 0" << endl; return 0; } int scores[n]; for (int i = 0; i < n; ++i) { cin >> scores[i]; // 输入每个学生的成绩 } int total = 0; int maxScore = scores[0]; int minScore = scores[0]; for (int i = 0; i < n; ++i) { total += scores[i]; // 累加总分 if (scores[i] > maxScore) { maxScore = scores[i]; // 更新最高分 } if (scores[i] < minScore) { minScore = scores[i]; // 更新最低分 } } double average = static_cast<double>(total) / n; // 计算平均分 // 设置输出格式,保留两位小数 cout << fixed << setprecision(2); cout << total << " " << average << " " << maxScore << " " << minScore << endl; return 0; }


Run Info:

  File "Main.py", line 3
    using namespace std;
                  ^
SyntaxError: invalid syntax