hdu

xiaoxiao2021-02-28  27

import java.text.DecimalFormat; import java.util.Scanner; /** * Created by feyman1120 on 2017/11/23. */ public class Main { public static void main(String [] args){ Scanner scan = new Scanner(System.in); while (scan.hasNext()){ int m = scan.nextInt(); if (0 == m){ break; } double minV = 1e10; double maxV = 0; double sum = 0.0; for (int i = 0; i < m; ++i){ double x = scan.nextDouble(); sum += x; minV = Math.min(minV, x); maxV = Math.max(maxV, x); } sum -= minV + maxV; sum /= (m - 2); DecimalFormat df = new DecimalFormat("#0.00"); System.out.println(df.format(sum)); } } }
转载请注明原文地址: https://www.6miu.com/read-2300178.html

最新回复(0)