본문 바로가기

Problem Solving/Baekjoon1338

[백준] 1110 더하기 사이클 - Implementation / Java • 문제 링크 1110번: 더하기 사이클 0보다 크거나 같고, 99보다 작거나 같은 정수가 주어질 때 다음과 같은 연산을 할 수 있다. 먼저 주어진 수가 10보다 작다면 앞에 0을 붙여 두 자리 수로 만들고, 각 자리의 숫자를 더한다. 그 다음, www.acmicpc.net • 풀이 코드 import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.util.HashSet; import java.util.Set; public class Main { public static void main(String[] args) throws IOException { BufferedWriter.. 2024. 3. 18.
[백준] 1152 단어의 개수 - Implementation / Java • 문제 링크 1152번: 단어의 개수 첫 줄에 영어 대소문자와 공백으로 이루어진 문자열이 주어진다. 이 문자열의 길이는 1,000,000을 넘지 않는다. 단어는 공백 한 개로 구분되며, 공백이 연속해서 나오는 경우는 없다. 또한 문자열 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.StringTokenizer; public class Main { public static void main(Stri.. 2024. 3. 17.
[백준] 15008 Falling Apart - Greedy / Java • 문제 링크 15008번: Falling Apart After acquiring a new integer and showing it off to other couples at a cocktail party, Alice and Bob headed home for a good night of sleep. As their integer was quite large, they were forced to carry it together. Then, on the Boole Boulevard, right by the www.acmicpc.net • 풀이 코드 import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWr.. 2024. 3. 16.
[백준] 27951 옷걸이 - Greedy / Java • 문제 링크 27951번: 옷걸이 경기과학고등학교에는 아주 무시무시한 부서 하나가 있다. 그 부서의 이름은 바로 '자치부'이다. '자치부'가 하는 주된 역할 중 하나는 아침에 지정된 기숙사에 들어가서 방의 정리 정돈 상태를 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. 3. 15.
[백준] 15600 Boss Battle - Greedy / Java • 문제 링크 15600번: Boss Battle You are stuck at a boss level of your favourite video game. The boss battle happens in a circular room with n indestructible pillars arranged evenly around the room. The boss hides behind an unknown pillar. Then the two of you proceed in turns. First, in y www.acmicpc.net • 풀이 코드 import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWri.. 2024. 3. 14.
[백준] 30236 증가 수열 - Greedy / Java • 문제 링크 30236번: 증가 수열 수열 $a_{1}, a_{2}, \ldots, a_{n}$이 주어진다. 다음 조건을 만족하는 수열 $b_{1}, b_{2}, \ldots, b_{n}$을 좋은 수열이라고 정의한다: $b_{i}$는 양의 정수이다($i = 1, 2, \ldots, n$). $b_{i} \neq a_{i}$이다($i = 1, 2, \ldo 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 {.. 2024. 3. 13.