본문 바로가기

Problem Solving1244

[백준] 16200 해커톤 - Greedy / Java • 문제 링크 16200번: 해커톤 예를 들어, 5명의 학생이 있고, X1 = 1, X2 = 2, X3 = 5, X4 = 2, X5 = 1인 경우에 팀의 수의 최솟값은 4이다. {1}, {2}, {3}, {4}, {5}로 5개의 팀을 만드는 방법이 있지만, 이것은 팀의 수가 최소가 아니다. {1}, {3} 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 { Buf.. 2024. 2. 13.
[백준] 14720 우유 축제 - Greedy / Java • 문제 링크 14720번: 우유 축제 영학이는 딸기우유, 초코우유, 바나나우유를 좋아한다. 입맛이 매우 까다로운 영학이는 자신만의 우유를 마시는 규칙이 있다. 맨 처음에는 딸기우유를 한 팩 마신다. 딸기우유를 한 팩 마신 후 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 OutputStreamWriter(System.out).. 2024. 2. 12.
[백준] 27940 가지 산사태 - Greedy / Java • 문제 링크 27940번: 가지 산사태 첫째 줄에 농장의 층수 $N$, 비가 오는 횟수 $M$, 각 층이 버틸 수 있는 빗물의 양을 나타내는 정수 $K$가 주어진다. $(1 \le N \le 10^5;$ $1 \le M \le 10^6;$ $1 \le K \le 2 \times 10^9)$ 둘째 줄부터 $M$개의 줄에 걸 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 .. 2024. 2. 11.
[백준] 27563 Moo Operations - Greedy / Java • 문제 링크 27563번: Moo Operations Because Bessie is bored of playing with her usual text string where the only characters are 'C,' 'O,' and 'W,' Farmer John gave her $Q$ new strings ($1 \leq Q \leq 100$), where the only characters are 'M' and 'O.' Bessie's favorite word out of the characte www.acmicpc.net • 풀이 코드 import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOExcepti.. 2024. 2. 10.
[백준] 11255 ITAI Virus - Graph Theory / Java • 문제 링크 11255번: ITAI Virus “Insane Transferable Abnormal Illness” or ITAI for short, is a new viral disease first discovered in a southern part of some city. The symptom is that persons contract with virus will continuously and uncontrollably scream “Itai, itai!” When this v www.acmicpc.net • 풀이 코드 import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; impo.. 2024. 2. 9.
[백준] 10328 Jury Jeopardy - Graph Theory / Java • 문제 링크 10328번: Jury Jeopardy On the first line one positive number: the number of test cases, at most 100. After that per test case: one line with two space-separated integers h and w (3 ≤ h, w ≤ 100): the height and width of the maze, respectively. h lines, each with w characters www.acmicpc.net • 풀이 코드 import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; i.. 2024. 2. 8.