본문 바로가기

Problem Solving1245

[백준] 11968 High Card Wins - Greedy / Java • 문제 링크 11968번: High Card Wins Bessie the cow is a huge fan of card games, which is quite surprising, given her lack of opposable thumbs. Unfortunately, none of the other cows in the herd are good opponents. They are so bad, in fact, that they always play in a completely predictable fas www.acmicpc.net • 풀이 코드 import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStream.. 2023. 12. 22.
[백준] 16406 Exam - Greedy / Java • 문제 링크 16406번: Exam Your friend and you took the same true/false exam. You know your answers, your friend’s answers, and the number of your friend’s answers that were correct. Compute the maximum possible score you could have gotten www.acmicpc.net • 풀이 코드 import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.O.. 2023. 12. 21.
[백준] 20974 Even More Odd Photos - Greedy / Java • 문제 링크 20974번: Even More Odd Photos In this example, one way to form the maximum number of five groups is as follows. Place 2 in the first group, 11 in the second group, 13 and 1 in the third group, 15 in the fourth group, and 17 and 3 in the fifth group. www.acmicpc.net • 풀이 코드 import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; public class Main { pub.. 2023. 12. 20.
[백준] 15761 Lemonade Line - Greedy / Java • 문제 링크 15761번: Lemonade Line It's a hot summer day out on the farm, and Farmer John is serving lemonade to his $N$ cows! All $N$ cows (conveniently numbered $1 \dots N$) like lemonade, but some of them like it more than others. In particular, cow $i$ is willing to wait in a line behin www.acmicpc.net • 풀이 코드 import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamW.. 2023. 12. 19.
[백준] 28323 불안정한 수열 - Greedy / Java • 문제 링크 28323번: 불안정한 수열 $N$개의 자연수가 좌우 일렬로 놓여 있다. 왼쪽에서 $i$ ($1 \le i \le N$)번째에 놓여 있는 자연수는 $A_i$다. 여러분은 이 중 몇 개의 자연수를 원하는 만큼 고를 수 있다. 단, 아무 자연수도 고르지 않 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 OutputS.. 2023. 12. 18.
[백준] 4993 Red and Black - Graph Theory / Java • 문제 링크 4993번: Red and Black There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can't move on red tiles, he can move only on black tiles. Wr www.acmicpc.net • 풀이 코드 import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException.. 2023. 12. 17.