공부기록/백준

[백준] 1546번 평균

메델 2023. 11. 21. 04:31
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
    	Scanner kb = new Scanner(System.in);
    	int n = kb.nextInt();
    	int[] scores = new int [n];
    	
    	for(int i=0; i<n; i++) {
    		scores[i] = kb.nextInt();
    	}
    	Arrays.sort(scores);
    	
    	double max = (double) scores[n-1];
    	double sum = 0;
    	
    	for(int i=0; i<n; i++) {
    		sum += (((double) scores[i])/(double) max)*100;
    	}
    	
    	System.out.println(sum/(double)n);
    	
    	
    }
}