문제 출처 : https://www.acmicpc.net/
#4344: 평균은 넘겠지 (언어 : Java11)
제출 답안
import java.util.*;
public class Main{
public static void main(String[] args) {
int interval = sc.nextInt();
for(int i=0; i<interval; i++) {
int num = sc.nextInt();
int[] score = new int[num];
int total = 0;
for(int j=0; j<score.length; j++) {
int temp = sc.nextInt();
score[j] = temp;
total += temp;
}
double avg = total*1.0/num;
int count = 0;
for(int j=0; j<score.length; j++) {
if(avg < score[j]*1.0)
count++;
}
avg = 100*1.0/num*count;
System.out.printf("%.3f%%\n", avg);
}
}
}
comment
-
'Study📚 > 백준' 카테고리의 다른 글
[백준] - #10872: 팩토리얼 (0) | 2024.05.30 |
---|---|
[백준] - #1978: 소수 찾기 (0) | 2024.05.29 |
[백준] - #2750: 수 정렬하기 (0) | 2024.05.28 |
[백준] - #2908: 상수 (0) | 2024.05.28 |
[백준] - #1157: 단어 공부 (0) | 2024.05.27 |