백준 1546

김경욱·2025년 6월 23일

백준

목록 보기
2/121

import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);

int count = in.nextInt();


double[] numbers = new double[count];
double[] values = new double[count];


for (int i =0 ; i < count; i++)
  {
    int scores = in.nextInt();
    numbers[i] = scores;
  }
  double max = numbers[0];

for (int i =0; i < count; i++)
  {
    if (numbers[i] > max)
    {
      max = numbers[i];
      
    }
  }

for (int i = 0; i < count ; i++)
  {
    values[i] =  numbers[i] / max * 100;
  }
double total = 0 ;
for (int i =0; i < count; i++)
  {
    total += values[i];
  }

System.out.println((double) total/count);

}
}

스페셜 저지였지만 난이도는 상당히 낮았다. 문제를 풂에 있어 어려운 점은 없었지만 numbers[i]를 처음에 int로 둔 것이 문제여서 나중에 다시 double로 바꾼 것 정도가 이 문제에서 헷갈린 점인 것 같다.

0개의 댓글