Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
111104 小徐老师 计算平均数 C++ Accepted 1 MS 276 KB 548 2025-02-26 21:08:52

Tests(10/10):


Code:

#include <bits/stdc++.h> using namespace std; int main() { int a[5]; for(int i = 0; i < 5; ++i) cin >> a[i]; int s = 0; for(int i = 0; i < 5; ++i) { s = s + a[i]; } float p = 1.0 * s / 5; //cout << p << endl; //printf("%.2f\n", p); //cout << fixed << setprecision(2) << p << '\n'; cout << fixed << setprecision(2) << p << endl; for(int i = 0; i < 5; ++i) { if(a[i] > p) cout << a[i] << ' '; } cout << endl; return 0; }