diff --git "a/suyeun84/202511/08 BOJ G5 \354\240\234\352\263\261\354\210\230 \354\260\276\352\270\260.md" "b/suyeun84/202511/08 BOJ G5 \354\240\234\352\263\261\354\210\230 \354\260\276\352\270\260.md" new file mode 100644 index 00000000..5458b767 --- /dev/null +++ "b/suyeun84/202511/08 BOJ G5 \354\240\234\352\263\261\354\210\230 \354\260\276\352\270\260.md" @@ -0,0 +1,54 @@ +```java +import java.io.*; +import java.util.*; + +public class Main { + public static int N, M; + public static int[][] map; + public static String S, T; + public static int result = -1; + public static void main(String[] args) throws IOException{ + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + + StringTokenizer st = new StringTokenizer(br.readLine()); + N = Integer.parseInt(st.nextToken()); + M = Integer.parseInt(st.nextToken()); + + map = new int[N][M]; + for(int i=0;i= 0 && nI < N && nJ >= 0 && nJ < M) { + now *= 10; + now += map[nI][nJ]; + + int sqrt_check = (int) Math.sqrt( (double) now); + if( sqrt_check * sqrt_check == now) result = Math.max(result, now); + + nI += di; + nJ += dj; + } + } + } + } + } + System.out.println(result); + } +} +```