Click
Here to go back to the homepage.
Statistics Solution:
#include <bits/stdc++.h>
using namespace std;
int main(){
// #ifndef TESTING
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
// #endif
int caseNum = 1;
int nums;
while(cin >> nums){
vector<int> v;
int max = INT_MIN;
int min = INT_MAX;
while(nums--){
int curr;
cin >> curr;
if(curr > max){
max = curr;
}
if(curr < min){
min = curr;
}
}
cout << "Case " << caseNum++ << ": " << min << " " << max << " "<< max - min << endl;
}
return 0;
}