1
2026-10-30 20:03:34
发布于:广东
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;int main() {ios::sync_with_stdio(false);cin.tie(NULL);int n;if (!(cin >> n)) return 0;vector<int> times(n);for (int i = 0; i < n; ++i) {cin >> times[i];}sort(times.begin(), times.end());long long total_wait_time = 0;for (int i = 0; i < n - 1; ++i) {total_wait_time += (long long)times[i] * (n - 1 - i);}double average_wait_time = (double)total_wait_time / n;cout << fixed << setprecision(2) << average_wait_time << endl;return 0;}
这里空空如也


















有帮助,赞一个