본문 바로가기

Problem Solving/Baekjoon1337

[백준] 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.
[백준] 15242 Knight - Graph Theory / Java • 문제 링크 15242번: Knight In Chess, the knight is the weirdest of all the pieces. To begin with, the piece is actually a horse without any human riding it. The second reason is its movement pattern. It can move 2 cells forward and one to the side. Below you can see all the possible www.acmicpc.net • 풀이 코드 import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; impo.. 2023. 12. 16.
[백준] 6207 Cow Picnic - Graph Theory / Java • 문제 링크 6207번: Cow Picnic The cows are having a picnic! Each of Farmer John's K (1 2023. 12. 15.
[백준] 18788 Swapity Swap - Graph Theory / Java • 문제 링크 18788번: Swapity Swap Initially, the order of the cows is $[1,2,3,4,5,6,7]$ from left to right. After the first step of the process, the order is $[1,5,4,3,2,6,7].$ After the second step of the process, the order is $[1,5,7,6,2,3,4]$. Repeating both steps a second time yields t www.acmicpc.net • 풀이 코드 import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWr.. 2023. 12. 14.
[백준] 6189 Munching - Graph Theory / Java • 문제 링크 6189번: Munching Bessie loves her grass and loves to hurry to the barn for her evening milking session. She has partitioned the pasture into a rectilinear grid of R (1 2023. 12. 13.