문제링크
https://www.acmicpc.net/problem/1546
나의코드
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;
public class Main{
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
double arr[] = new double[Integer.parseInt(br.readLine())];
StringTokenizer st = new StringTokenizer(br.readLine()," ");
for(int i = 0; i < arr.length; i++){
arr[i] = Double.parseDouble(st.nextToken());
}
Arrays.sort(arr);
double sum = 0;
for(int i = 0; i < arr.length; i++){
sum = sum + ((arr[i] / arr[arr.length - 1]) * 100) / arr.length;
}
System.out.print(sum);
}
}
'Baekjoon Online Judge' 카테고리의 다른 글
[BOJ] 백준 4344번: 평균은 넘겠지 (Java) (0) | 2023.03.12 |
---|---|
[BOJ] 백준 8958번: OX퀴즈 (Java) (0) | 2023.03.11 |
[BOJ] 백준 3052번: 나머지 (Java) (0) | 2023.03.09 |
[BOJ] 백준 5597번: 과제 안 내신 분..? (Java) (0) | 2023.03.08 |
[BOJ] 백준 2562번 최댓값 (Java) (0) | 2023.03.07 |
댓글