java
查看原帖
java
526386
7teen楼主2024/3/7 09:18
import java.text.DecimalFormat;
import java.util.Scanner;

public class Main {


    public static void main(String args[]) {
          Scanner scanner = new Scanner(System.in);

        //  1
        //    public static void main(String[] args) {
//        Scanner scanner = new Scanner(System.in);
//        int n1 = scanner.nextInt();
//        int n2 = scanner.nextInt();
//
//        System.out.println(n1 * n2);
//
//    }


        //2
//    public static void main(String args[]) {
//        Scanner sc = new Scanner(System.in);
//        int a = sc.nextInt();
//        int b = sc.nextInt();
//        float f = Float.parseFloat(a + "." + b);
//        System.out.println((int) (f / 1.9));
//    }

        //3
//        int a,b,c,d;
//        Scanner cin =new Scanner(System.in);
//
//
//        a=cin.nextInt();
//        b=cin.nextInt();
//        c=cin.nextInt();
//        d=cin.nextInt();
//
//        int t1 = a * 60 + b;
//        int t2 = c * 60 + d;
//        int ans = t2 - t1;
//        int shi = ans/60;
//        int fen = ans % 60;
//        System.out.printf("%d %d",shi,fen);


//        Scanner scan = new Scanner(System.in);
//        String s = scan.next();
//        char a = s.charAt(0);
//        System.out.println((char)(a-32));

        //p5711

//        int n = scanner.nextInt();
//        System.out.println(((n%4==0&&n%100!=0)||(n%400==0))?1:0);

        //p5715
//        int[] a = new int[3];
//        for(int i = 0; i < 3; i++){
//            a[i] = scanner.nextInt();
//        }
//
//        for(int i = 0; i < 3; i++){
//            for(int j = i; j < 3; j++){
//                if(a[i] > a[j]){
//                    int temp = a[i];
//                    a[i] = a[j];
//                    a[j] = temp;
//                }
//            }
//        }
//        System.out.println(a[0] + " " + a[1] + " " + a[2]);


//        int year = scanner.nextInt();
//        int day = scanner.nextInt();
//        int[] a= new int[]{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
//        if(year % 4 == 0 && year % 100 != 0 || year % 400 == 0){
//            a[2]=29;
//        }
//
//        System.out.println(a[day]);




//        int x,n,ans=0;
//        x = scanner.nextInt();
//        n = scanner.nextInt();
//        for(int i = 0;i < n;i++){
//            if(x != 6 && x != 7){
//                ans += 250;
//            }
//            if(x == 7){
//                x = 1;
//            }
//            else{
//                x++;
//            }
//        }
//        System.out.println(ans);

//
//        int num = scanner.nextInt();
//        boolean flag;
//        long sum=0;
//        long k=0;
//        long x=2;
//        while(sum <= num)//循环开始!!
//        {
//            if(x == 2) {//当x==2时特判,否则输出不了
//                sum += x;//sum的值往上加
//                if(sum <= num){
//                    k++;
//                    System.out.println(x);
//                }
//
//            }
//            else{
//                flag = true;//旗帜需要初始化
//
//                for(int j = 2;j < x;j++)
//                //从2~x-1判断这时x是否为质数
//                {
//                    if(x % j == 0) {
//                        flag = false;
//                        break;
//                    }
//                    //如果有了,旗帜倒下,代表不是
//                }
//                if(flag)//如果旗帜还是升起状态,x就是质数
//                {
//
//                    sum += x;
//                    if(sum <= num){
//                        k++;
//                        System.out.println(x);
//                    }
//
//
//                }
//            }
//            x++; //每次x都要加1,指导sum < n;
//        }
//        System.out.println(k);

//        p5726
        double n = scanner.nextInt();
        double max = 2,min = 1001,sum = 0;
        for (int i = 0; i < n; i++) {
            int a = scanner.nextInt();
            if(a > max){
                max = a;
            }
            if(a < min){
                min = a;
            }
            sum += a;
        }
        sum -= max + min;

        System.out.println(String.format("%.2f",sum / (n - 2)));






    }

}

2024/3/7 09:18
加载中...