9 solutions

  • -2
    @ 2025-1-15 11:32:19
    #include <iostream>
    #include <vector>
    #include <algorithm>
    #include <cmath>
    #include <iomanip>
    using namespace std;
    
    int main() {
        int n;
        cin >> n;
        vector<double> samples(n);
        for (int i = 0; i < n; ++i) {
            cin >> samples[i];
        }
        sort(samples.begin(), samples.end());  // 对样本进行排序
        double sum = 0.0;
        for (int i = 1; i < n - 1; ++i) {
            sum += samples[i];
        }
        double average = sum / (n - 2);  // 平均白细胞数量
        double maxDiff = 0.0;
        for (int i = 1; i < n - 1; ++i) {
            maxDiff = max(maxDiff, abs(samples[i] - average));
        }
        cout << fixed << setprecision(2) << average << " " << maxDiff << endl;
        return 0;
    }
    
    

    这个是对的,可以试一试,不对的话给差评,如果是对的,麻烦给个好评,谢谢!

    • @ 2025-7-21 10:53:29

      想的美

    • @ 2025-7-21 10:54:58

      undefined 大家快给差评!被给好评

    • @ 2025-7-24 16:19:12

      还是用AI来写的

Information

ID
897
Time
1000ms
Memory
256MiB
Difficulty
3
Tags
(None)
# Submissions
272
Accepted
49
Uploaded By