본문 바로가기
알고리즘 일기

swea_d1_2063_중간값찾기

by Beijing_KingGod 2020. 1. 20.

1) 정렬 

2) 중간값출력

package algo;

import java.io.*;
import java.util.*;

public class Solution_d1_2063_중간값찾기 {
	public static void main(String args[]) throws Exception
	{
		System.setIn(new FileInputStream("res/input_2063.txt"));
//85 72 38 80 69 65 68 96 22
		// 22 38 65 68 69 
		Scanner sc = new Scanner(System.in);
		int T;
		T=sc.nextInt();
		int[] data = new int[T];
		int ans=0;
		for(int i=0; i<T; i++) {
			data[i]=sc.nextInt();
		}
		Arrays.sort(data);
		System.out.println(data[T/2]);
	}
}

'알고리즘 일기' 카테고리의 다른 글

swea_d2_1204_최빈수구하기  (0) 2020.01.20
swea_d3_3307_최장증가부분수열  (0) 2020.01.20
프로그래머스 탬플릿  (0) 2019.12.17
c++ map 사용법  (0) 2019.12.10
프로그래머스 : 저울  (0) 2019.12.10

댓글