From 2dadff05f23abc2308cf340770d1404ae417086c Mon Sep 17 00:00:00 2001 From: songyc macbook Date: Sat, 19 Jul 2025 21:06:54 +0900 Subject: [PATCH] 20250719 baekjoon --- code_study/Baekjoon/java/_1012.java | 46 +++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 code_study/Baekjoon/java/_1012.java diff --git a/code_study/Baekjoon/java/_1012.java b/code_study/Baekjoon/java/_1012.java new file mode 100644 index 0000000..ce4b540 --- /dev/null +++ b/code_study/Baekjoon/java/_1012.java @@ -0,0 +1,46 @@ +import java.util.*; + +public class _1012 { + + public static boolean dfs(int x, int y, int m, int n, int[][] cabbage, int[][] visited){ + if (visited[x][y] == 1) return false; + visited[x][y] = 1; + int[] dx = {1,-1,0,0}; + int[] dy = {0,0,-1,1}; + for(int i=0; i<4; i++) { + int next_x = x + dx[i]; + int next_y = y + dy[i]; + if((next_x>=0)&&(next_y>=0)&&(next_x