728x90

https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=1&contestProbId=AV5QPsXKA2UDFAUq&categoryId=AV5QPsXKA2UDFAUq&categoryType=CODE&problemTitle=&orderBy=FIRST_REG_DATETIME&selectCodeLang=ALL&select-1=1&pageSize=10&pageIndex=1

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

 

 

 

 

풀이) sw expert academy양식에 맞게 풀었더니 값은 올바르지만 런타임 오류가 발생해서 기존 양식 제외하고 풀었다.

import java.util.Scanner;
import java.io.FileInputStream;
import java.util.Arrays;


class Solution
{
	public static void main(String args[]) throws Exception
	{
		Scanner sc = new Scanner(System.in);
        int N;
        N = sc.nextInt();
        int ans = 0;
        int scores[] = new int[N];

        for(int i=0; i<N; i++){
            scores[i] = sc.nextInt();
            ans = N/2;
        }

        Arrays.sort(scores);
        System.out.println(scores[ans]);

	}
}
728x90