728x90
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int line = sc.nextInt();
for (int i = 0; i < line; i++) {
int student = sc.nextInt();
int[] arr = new int[student]; // 학생 수 만큼 배열
for (int j = 0; j < arr.length; j++) {
arr[j] = sc.nextInt(); // 0번지부터 길이만큼 점수 넣어줘
}
double total = 0;
double avg = 0;
double count = 0;
for (int k = 0; k < arr.length; k++) {
total += arr[k];
}
avg = total / student;
for (int h = 0; h < arr.length; h++) {
if (arr[h] > avg) {
count++;
}
}
double res = (count/student)*100;
System.out.printf("%.3f%%\n",res);
}
}
}
728x90
'알고리즘 > 백준(backjoon)' 카테고리의 다른 글
[Baekjoon]백준 NO.4673 셀프 넘버(실버5) / Java(자바) (0) | 2021.07.30 |
---|---|
[Baekjoon]백준 NO.15596 정수 N개의 합(브론즈2) / Java(자바) (0) | 2021.07.23 |
[Baekjoon]백준 NO.8958 OX퀴즈(브론즈2) / Java(자바) (0) | 2021.07.16 |
[Baekjoon]백준 NO.1542 평균(브론즈1) / Java(자바) (0) | 2021.07.15 |
[Baekjoon]백준 NO.3052 나머지(브론즈2) / Java(자바) (0) | 2021.07.14 |