Submission

Status:

PPPPPPPPPPPPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: helloskibidi

Problemset: RANGEandMEAN

Language: cpp

Time: 0.004 second

Submitted On: 2026-10-05 16:24:48

#include <bits/stdc++.h>
using namespace std;

int main(){
    int n; cin >> n;

    vector<long long> x;

    for(int i=0;i<n;i++){
        int temp;
        cin >> temp;
        x.push_back(temp);
    }

    sort(x.begin() , x.end());
    int sum = accumulate(x.begin() , x.end() , 0);
    int range = x[n-1] - x[0];
    float average = (float)sum/float(n);

    cout << range << ' ' << fixed << setprecision(2) << average;
}