본문 바로가기

Problem Solving/Baekjoon1338

[백준] 28110 마지막 문제 - Greedy / Java • 문제 링크 28110번: 마지막 문제 때는 3023년, PPC 출제진들은 심혈을 기울여 PPC에 출제할 $N$개의 문제를 정했다. 각 문제는 $1$ 이상 $10^9$ 이하의 정수로 표현되는 난이도를 가지고 있으며, $N$개의 문제에 대한 난이도는 모두 다르 www.acmicpc.net • 풀이 코드 import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.util.Arrays; public class Main { public static void main(String[] args) throws IOException { BufferedWriter bw = new Buffe.. 2024. 3. 12.
[백준] 9329 패스트 푸드 상금 - Greedy / Java • 문제 링크 9329번: 패스트 푸드 상금 입력은 여러개의 테스트 케이스로 이루어져있다. 각 테스트 케이스마다 첫째 줄에는 서로 다른 상금의 종류 n (1 ≤ n ≤ 10) 과 코치가 가지고 있는 스티커의 종류 (1 ≤ m ≤ 30, 종류는 1부터 m까지 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 { public static void main(String[] args) throws IOException { Buffe.. 2024. 3. 11.
[백준] 9372 상근이의 여행 - Graph Theory / Java • 문제 링크 9372번: 상근이의 여행 첫 번째 줄에는 테스트 케이스의 수 T(T ≤ 100)가 주어지고, 각 테스트 케이스마다 다음과 같은 정보가 주어진다. 첫 번째 줄에는 국가의 수 N(2 ≤ N ≤ 1 000)과 비행기의 종류 M(1 ≤ M ≤ 10 000) 가 www.acmicpc.net • 풀이 코드 import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; public class Main { public static void main(String[] args) throws IOException { BufferedWriter bw = new BufferedWriter(new Output.. 2024. 3. 10.
[백준] 22035 Bus Lines - Graph Theory / Java • 문제 링크 22035번: Bus Lines If it is not possible to construct a graph with the given properties, print "-1". Otherwise, print $m$ lines where the $i$'th line contains two integers $a_i$, $b_i$, the endpoints of the $i$'th edge. If there are many possible solutions, any one of them w www.acmicpc.net • 풀이 코드 import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWrite.. 2024. 3. 9.
[백준] 5247 Mining Maps - Graph Theory / Java • 문제 링크 5247번: Mining Maps Connections between mines are described beginning with the line ”GRAPH BEGIN”. Additional lines lists individual mines (nodes), followed (on the same line) by their neighboring mines (edges). The line ”GRAPH END” ends the list of path descriptions. www.acmicpc.net • 풀이 코드 import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import j.. 2024. 3. 8.
[백준] 20914 QWERTY 자판 - Graph Theory / Java • 문제 링크 20914번: QWERTY 자판 Albert는 QWERTY 키보드를 이용해 (위 그림 참고) 영문 대문자로 ('A'-'Z') 구성된 문자열을 입력하고 싶다. 아직 키보드 만지는 것이 서툰 Albert는 왼쪽 검지만을 이용해 버튼을 누르는 버릇이 있다. 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.Queue; public class .. 2024. 3. 7.