실수한 점으로는 출력조건을 제대로 안봐서 마지막 if문에서 System.out.print(c[i]); 로 써서 틀렸다는 점.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int a = scan.nextInt();
int b = scan.nextInt();
int[] c = new int[a];
if(1<=a && b<=10000){
for (int i = 0; i < c.length; ++i) {
c[i] = scan.nextInt();
if (c[i]<b){
System.out.print(c[i] + " ");
}
}
}
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs |
'알고리즘 > Java' 카테고리의 다른 글
(JAVA) 백준 알고리즘 4단계 10951번 : A + B - 4 (0) | 2020.04.17 |
---|---|
(JAVA) 백준 알고리즘 4단계 10952번 : A + B - 5 (0) | 2020.04.17 |
(JAVA) 백준 알고리즘 3단계 2439번 : 별찍기 - 2 (0) | 2020.04.14 |
(JAVA) 백준 알고리즘 3단계 2438번 : 별 찍기 - 1 (0) | 2020.04.09 |
(JAVA) 백준 알고리즘 3단계 11022번 : A + B - 8 (0) | 2020.04.09 |