런타임 에러 뜨는 예제입니다.
input
5 2
1 5
4 5
10811번 - 바구니 뒤집기
반례
5 1 2 4
1 2 3 4 5
1 4 3 2 5
7 1 3 5
1 2 3 4 5 6 7
1 2 5 4 3 6 7
10 1 6 9
1 2 3 4 5 6 8 7 9 10
1 2 3 4 5 9 8 7 6 10
실행 실패 예시:
10 3 7 7 2 7 9 10
런타임 에러 (RTE)
stderr:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 11 out of bounds for length 10
at Main.main(Main.java:23)
1 7 6 5 4 3 2 8 10 9
9 4 7 8 1 8 7 8 4 7
런타임 에러 (RTE)
stderr:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 11 out of bounds for length 9
at Main.main(Main.java:23)
7 8 6 1 3 4 5 2 9
8 5 2 8 1 4 7 7 3 3 2 3
런타임 에러 (RTE)
stderr:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 8
at Main.main(Main.java:22)
6 8 7 1 5 4 3 2
댓글을 작성하려면 로그인해야 합니다.
laelpa1010 1년 전
런타임에러가 왜 걸리는지 모르겠습니다