#include <iostream> #include <vector> #include <algorithm> #include <iomanip> int main() { int n; std::cin >> n; // 读取苹果数量 std::vector<int> apples(n); // 存储苹果重量 for (int i = 0; i < n; ++i) { std::cin >> apples[i]; // 读取每个苹果的重量 } int minWeight = *std::min_element(apples.begin(), apples.end()); // 找到最小重量 int countMin = std::count(apples.begin(), apples.end(), minWeight); // 统计最小重量苹果的个数 double totalWeight = 0; for (int weight : apples) { if (weight!= minWeight) { totalWeight += weight; // 计算去除最小重量苹果后的总重量 } } double averageWeight = totalWeight / (apples.size() - countMin); // 计算平均重量 std::cout << std::fixed << std::setprecision(1) << averageWeight << std::endl; // 输出结果,保留一位小数 return 0; } /************************************************************** Problem: 1218 User: zhenghaoxuan Language: C++ Result: Accepted Time:17 ms Memory:2072 kb ****************************************************************/