백준 java 10871 X보다 작은수

임명수·2023년 5월 7일
0

백준

목록 보기
13/31

https://www.acmicpc.net/problem/10871


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main{

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        StringTokenizer st = new StringTokenizer(br.readLine()," ");

        int N = Integer.parseInt(st.nextToken());
        int X = Integer.parseInt(st.nextToken());

        StringBuilder sb = new StringBuilder();

        st= new StringTokenizer(br.readLine()," ");

        for(int i =0; i< N ; i++){
            int value = Integer.parseInt(st.nextToken());

            if(value < X){
                sb.append(value).append(' ');
            }
        }
        System.out.println(sb);
    }
}
profile
푸른영혼의별

0개의 댓글