BFS

    녹색 옷 입은 애가 젤다지? - 4485번

    녹색 옷 입은 애가 젤다지? - 4485번

    package com.company; import java.io.*; import java.util.*; public class Main { static int[][] d = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}}; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = null; StringBuilder sb = new StringBuilder(); int N = 0; int T = 1; while ((N = Integer.parseInt(br.readLine(..

    달이 차오른다, 가자. - 1194번

    달이 차오른다, 가자. - 1194번

    package com.company; import java.io.*; import java.util.*; public class Main { static int[][] d = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}}; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int N = Integer.parseInt(st.nextToken()); int M = Integer.parseInt(st.nex..

    백조의 호수 - 3197번

    백조의 호수 - 3197번

    내 코드 package com.company; import java.io.*; import java.util.*; /** * 먼저 호수가 물로 변하는 시간을 저장 * 백조가 최소로 움직이는 날 구함 */ public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int R = Integer.parseInt(st.nextToken()); int C = Integer.parseInt(st.nex..