Submission
Status:
PPPPPPPPPPPPPPPPPPPP
Score: 100
User: Pera
Problemset: RANGEandMEAN
Language: cpp
Time: 0.003 second
Submitted On: 2025-05-18 18:09:52
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
int n; cin >> n;
int max = INT_MIN;
int min = INT_MAX;
int sum = 0;
for (int i = 0; i < n; i++) {
int x; cin >> x;
sum += x;
if (x > max) max = x;
if (x < min) min = x;
}
double mean = (double)sum / n;
int range = max - min;
cout << range << " " << fixed << setprecision(2) << mean << '\n';
}