문제
링크
코드
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));
StringBuilder sb = new StringBuilder();
StringTokenizer st = new StringTokenizer(br.readLine(), " ");
int N = Integer.parseInt(st.nextToken());
int X = Integer.parseInt(st.nextToken());
st = new StringTokenizer(br.readLine(), " ");
br.close();
for (int i = 0; i < N; i++) {
int number = Integer.parseInt(st.nextToken());
if (number < X) {
sb.append(number).append(" ");
}
}
System.out.println(sb);
}
}
리뷰