#include <algorithm> int main() { int n; std::cin >> n; if (n <= 0) { std::cout << "苹果数量必须大于0" << std::endl; return 1; } std::vector<int> weights(n); for (int i = 0; i < n; ++i) { std::cin >> weights[i]; } // 找到最小的苹果重量 int min_weight = *std::min_element(weights.begin(), weights.end()); // 计算去掉最小苹果后的总重量和数量 double total_weight = 0.0; int count = 0; for (int weight : weights) { if (weight != min_weight) { total_weight += weight; ++count; } } // 计算平均重量并保留一位小数 double average_weight = count > 0 ? total_weight / count : 0.0; printf("%.1f\n", average_weight); return 0; } /************************************************************** Problem: 1218 User: zhenghaoxuan Language: C++ Result: Compile Error ****************************************************************/