반응형
https://www.acmicpc.net/problem/10871
import java.util.Arrays;
import java.util.Scanner;
public class num10871 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int A = sc.nextInt();
int[] arr = new int[N];
for(int j=0;j<N;j++) {
arr[j] = sc.nextInt();
}
for (int i=0;i<arr.length;i++) {
if (arr[i] < A) {
System.out.println(arr[i]);
}
}
}
}
- j > i 순인 이유 : 처음에 배열 값을
int[] new int[sc.nextInt(N)]
로 받아도 되는 줄 알고...요령피웠다가...ㅎ... 뒤늦게 추가해서 j가 i보다 먼저 나온..네..
그래도 arr값 받는것에 대한 힌트만 살짝 참조했다(나자신 장하다)
반응형
'I am a developer' 카테고리의 다른 글
[JAVA] 백준 1110 - 다시풀기 (0) | 2021.06.18 |
---|---|
[JAVA] 백준 10951 (0) | 2021.06.18 |
[JAVA] 백준 2439 별찍기 - 2 (0) | 2021.06.14 |
xcode 첫(사실 오랜만에) 사용기 (0) | 2021.06.14 |
SQL 쿼리문 (0) | 2021.06.10 |
댓글