본문 바로가기

Problem Solving1240

[백준] 28256 초콜릿 보관함 - Graph Theory / Java • 문제 링크 28256번: 초콜릿 보관함 각 테스트 케이스마다, 화면의 표시가 올바르다면 1, 아니라면 0을 출력한다. www.acmicpc.net • 풀이 코드 import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Queue; import java.u.. 2023. 10. 18.
[백준] 18232 텔레포트 정거장 - Graph Theory / Java • 문제 링크 18232번: 텔레포트 정거장 첫 번째 줄에 정수 N, M이 공백으로 구분되어 주어진다. (2 ≤ N ≤ 300,000, 0 ≤ M ≤ min(N×(N-1)/2, 300,000)) 두 번째 줄에 정수 S, E가 공백으로 구분되어 주어진다. (1 ≤ S, E ≤ N, S ≠ E) 그 다음 줄부터 M www.acmicpc.net • 풀이 코드 import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.List; import java.util.Queue; p.. 2023. 10. 17.
[백준] 26170 사과 빨리 먹기 - Graph Theory / Java • 문제 링크 26170번: 사과 빨리 먹기 (2, 3) -> (2, 2) -> (2, 1) -> (3, 1) -> (3, 0) -> (2, 0) -> (1, 0) -> (0, 0) -> (0, 1) -> (0, 2) 가 최소 이동으로 사과 3개를 먹는 경우이다. www.acmicpc.net • 풀이 코드 import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; public class Main { static int[][] mat = new int[5][5]; static boolean[][] visit = new boolean[5][5]; static int[] dy = {-1, 1, 0, 0.. 2023. 10. 16.
[백준] 26169 세 번 이내에 사과를 먹자 - Graph Theory / Java • 문제 링크 26169번: 세 번 이내에 사과를 먹자 5 x 5 크기의 보드가 주어진다. 보드는 1 x 1 크기의 정사각형 격자로 이루어져 있다. 보드의 격자는 사과가 1개 있는 격자, 장애물이 있는 격자, 빈칸으로 되어 있는 격자로 구분된다. 격자의 위치 www.acmicpc.net • 풀이 코드 import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; public class Main { static int[][] mat = new int[5][5]; static boolean[][] visit = new boolean[5][5]; static int[] dy = {-1, 1, 0, 0}, .. 2023. 10. 15.
[백준] 13237 Binary tree - Graph Theory / Java • 문제 링크 13237번: Binary tree A binary tree is a mathematical structure made of nodes where each node can have up to two children nodes. One child node will be called left child and the other right child. ch If node B is a child node of A, then we say that A is the parent node of B. In www.acmicpc.net • 풀이 코드 import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWri.. 2023. 10. 14.
[백준] 21316 스피카 - Graph Theory / Java • 문제 링크 21316번: 스피카 위 그림은 처녀자리 중 12개의 별을 12개의 선분으로 이어 만든 그림이다. 시은이는 임의로 각 별에 1부터 12까지의 서로 다른 정수 번호를 부여하고, 12개의 정수 쌍으로 각 선분이 어떤 두 별을 www.acmicpc.net • 풀이 코드 import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.List; public class Main { static Node[] graph = new Node[13]; public static void main(String[] args) th.. 2023. 10. 13.