package division; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int h = sc.nextInt(); int w = sc.nextInt(); char[][] map = new char[h][]; for(int i=0;i= h || nj < 0 || nj >= w) { continue LOOP; } if (map[ni][nj] != '#' || painted[i][j]) { continue LOOP; } painted[i][j] = painted[ni][nj] = true; count++; } } } if (count >= 1) { return true; } } } return false; } }