https://www.acmicpc.net/problem/10871
10871번: X보다 작은 수
첫째 줄에 N과 X가 주어진다. (1 ≤ N, X ≤ 10,000) 둘째 줄에 수열 A를 이루는 정수 N개가 주어진다. 주어지는 정수는 모두 1보다 크거나 같고, 10,000보다 작거나 같은 정수이다.
www.acmicpc.net
public class Boj10871_X보다작은수 {
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());
st = new StringTokenizer(br.readLine());
for (int i = 0; i < n; i++) {
int t = Integer.parseInt(st.nextToken());
if (t < x ) {
System.out.print(t +" ");
}
}
}
}
'알고리즘 > 백준' 카테고리의 다른 글
백준 1100 하얀 칸 (0) | 2022.02.21 |
---|---|
백준 10820 문자열 분석 (0) | 2022.02.20 |
백준 10953 A+B-6 (0) | 2022.02.19 |
백준 2743 단어 길이 재기 (0) | 2022.02.19 |
백준 15552 빠른 A+B (0) | 2022.02.19 |