Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <algorithm>
- #include <iostream>
- #include <iomanip>
- #include <numeric>
- #include <vector>
- using namespace std;
- int main()
- {
- int t = 0, n = 0, sum, cnt;
- double temp = 0, ans, cmax;
- cin >> t;
- for (size_t i = 0; i < t; i++)
- {
- ans = 0;
- cmax = INT_MIN;
- cnt = 0;
- sum = 0;
- cin >> n;
- for (size_t j = 0; j < n; j++)
- {
- cin >> temp;
- sum += temp;
- if (temp > cmax) cmax = temp;
- }
- ans = cmax + (double)((sum - cmax) / (n - 1));
- cout << fixed << setprecision(9) << ans << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment