Run ID:164911
提交时间:2026-11-07 20:38:21
#include <iostream> #include <iomanip> using namespace std; int main() { int a[5]; double sum = 0; // 读入5个整数 for (int i = 0; i < 5; i++) { cin >> a[i]; sum += a[i]; } // 计算平均值,保留两位小数 double avg = sum / 5.0; cout << fixed << setprecision(2) << avg << endl; // 输出大于平均值的数 bool first = true; for (int i = 0; i < 5; i++) { if (a[i] > avg) { if (!first) cout << " "; cout << a[i]; first = false; } } cout << endl; return 0; }