break의 이용

sdseon21 Reply 4 years 51 weeks ago
input 값들을 1차 배열 the로 저장하고 index가 짝수인 값은 R (board에서는 1), 홀수는 Y(board에서는 2)로 저장하려고 짜고 있는데 i=0이후에 i=1이 돌아가지 않습니다.. 왤까요ㅠㅠ break가 이상한가요...?
sdseon21 Reply 4 years 51 weeks ago
헛 예시에 대한 답이 나오는 것까진 해결했는데 WA 뜨네요... ㅠㅠ
sdseon21 Reply 4 years 51 weeks ago
ㅠㅠ..
withcs2 Reply 4 years 51 weeks ago
isHori, isVerti, isDiag에 count 출력하는 코드 넣고 isDiag 맨 마지막에 is, isis, is&&isis 출력하는 코드 넣고 int[][] board1={ {0,0,0,0,0,0,0}, {0,0,0,0,0,0,0}, {0,0,0,0,0,0,0}, {0,0,0,0,0,0,0}, {0,0,0,0,0,0,0}, {0,0,0,1,1,1,1} }; int[][] board2={ {0,0,0,0,0,0,0}, {0,0,0,0,0,0,0}, {0,0,0,0,0,0,1}, {0,0,0,0,0,0,1}, {0,0,0,0,0,0,1}, {0,0,0,0,0,0,1} }; int[][] board3={ {0,0,0,0,0,0,0}, {0,0,0,0,0,0,0}, {0,0,0,1,0,0,0}, {0,0,0,0,1,0,0}, {0,0,0,0,0,1,0}, {0,0,0,0,0,0,1} }; int[][] board4={ {0,0,0,0,0,0,0}, {0,0,0,0,0,0,0}, {0,0,0,0,0,0,1}, {0,0,0,0,0,1,0}, {0,0,0,0,1,0,0}, {0,0,0,1,0,0,0} }; System.out.println(isHori(board1)); System.out.println(isVerti(board2)); System.out.println(isDiag(board3)); System.out.println(isDiag(board4)); 이 코드 한번 실행해보세요