baekjoon: 25305(커트라인)

강지안·2023년 5월 21일
0

baekjoon

목록 보기
30/186

문제

코드

import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

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

        int N = sc.nextInt();
        int k = sc.nextInt();
        ArrayList<Integer> inputs = new ArrayList<>();

        for(int i=0; i<N; i++)
            inputs.add(sc.nextInt());

        Collections.sort(inputs);

        System.out.println(inputs.get(inputs.size()-k));
    }
}

0개의 댓글