SWEA 2063 중간값 찾기

Jmnote (토론 | 기여)님의 2018년 9월 6일 (목) 20:07 판

1 개요

SWEA 2063 중간값 찾기
SW Expert 아카데미
# 문제 풀이

틀:SWEA 난이도 1-1

2 C++

3 Java

import java.util.Scanner;
import java.util.Arrays;
class Solution {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int nums[] = new int[N];
        for(int i=0; i<N; i++) nums[i] = sc.nextInt();
        Arrays.sort(nums);
        System.out.println( nums[(N-1)/2] );
    }
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}