본문 바로가기

Problem Solving1239

[백준] 5237 Connected or Not Connected - Graph Theory / Java • 문제 링크 5237번: Connected or Not Connected The first line in the test data file contains the number of test cases (≤ 50). After that, each line contains a test case. The first number in each test case is the number of sites, n (≤ 100). The sites are numbered from 0 to n − 1. The second number www.acmicpc.net • 풀이 코드 import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOEx.. 2023. 9. 17.
[백준] 9311 Robot in a Maze - Graph Theory / Java • 문제 링크 9311번: Robot in a Maze The input will be given first by a number that tells the number of different mazes in the input file. Following that, for each data set, there will be two integers, R and C. The first number, R, represents the number or rows in the maze, and the second num www.acmicpc.net • 풀이 코드 import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOExcepti.. 2023. 9. 16.
[백준] 13700 완전 범죄 - Graph Theory / Java • 문제 링크 13700번: 완전 범죄 첫째 줄에 N, S, D, F, B, K가 주어지고, K > 0인 경우에는 둘째 줄에 경찰서의 위치 l1, l2, …, lK가 주어진다. (1 ≤ S, D ≤ N ≤ 100000, 0 ≤ F, B ≤ 100000, 0 ≤ K ≤ N/2, S ≠ D ≠ l) www.acmicpc.net • 풀이 코드 import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.util.LinkedList; import java.util.Queue; public class Main { public static void main(String[] args) th.. 2023. 9. 15.
[백준] 21937 작업 - Graph Theory / Java • 문제 링크 21937번: 작업 민상이가 작업할 개수 $N$와 작업 순서 정보의 개수 $M$이 공백으로 구분되어 주어진다. 두 번째줄부터 $M + 1$ 줄까지 작업 $A_i$와 작업 $B_i$가 공백으로 구분되어 주어진다. 이때 두 값의 의미는 작 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; static boolean[] visit; public static void main(.. 2023. 9. 14.
[백준] 11370 Spawn of Ungoliant - Graph Theory / Java • 문제 링크 11370번: Spawn of Ungoliant The first line of an input case is of the form W H, where W is the width of the map and H is the height. The next H lines contain strings of length W specifying the layout of Mirkwood. An S character represents a spider-infested tree, and an T character re www.acmicpc.net • 풀이 코드 import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOExc.. 2023. 9. 13.
[백준] 14544 Vote - Data Structure / Java • 문제 링크 14544번: Vote The first line of input contains a single integer P, (1 ≤ P ≤ 1000), which is the number of data sets that follow. Each data set consists of a line containing the number n of the candidates (1 ≤ n ≤ 100), a space and the number m of results to cent www.acmicpc.net • 풀이 코드 import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.. 2023. 9. 12.