Scanner sc = new Scanner(System.in);
int test = sc.nextInt(); //케이스 수
int num = sc.nextInt(); //학생 수
int[] s = new int[num];
double avg = 0; //평균
for (int i = 0; i < test; i++) {
double total = 0;
int avgS = 0;
for (int j = 0; j < num; j++) {
s[j] = sc.nextInt();
total += s[j]; //합계 구하기
}
avg = total / num; //평균
for (int j = 0; j < num; j++) {
if (s[j]>avg){
avgS++;
}
}
System.out.printf("%.3f",100.0*avgS/num);
}
sc.close();
'Study > algorithm' 카테고리의 다른 글
백준 자바 알고리즘 [8958 : OX퀴즈] (0) | 2020.05.03 |
---|---|
백준 자바 알고리즘 [나머지] (0) | 2020.05.02 |
백준 자바 알고리즘 [숫자의 개수] (0) | 2020.04.30 |
백준 자바 알고리즘 [최댓값] (0) | 2020.04.30 |
백준 자바 알고리즘 [최소,최대] (0) | 2020.04.30 |