본문 바로가기

Problem Solving1241

[백준] 6080 Bad Grass - Graph Theory / Java • 문제 링크 6080번: Bad Grass Bessie was munching on tender shoots of grass and, as cows do, contemplating the state of the universe. She noticed that she only enjoys the grass on the wide expanses of pasture whose elevation is at the base level of the farm. Grass from elevations just www.acmicpc.net • 풀이 코드 import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter;.. 2023. 12. 12.
[백준] 10104 Party Invitation - Data Structure / Java • 문제 링크 10104번: Party Invitation The first line of input contains the integer K (1 ≤ K ≤ 100). The second line of input contains the integer m (1 ≤ m ≤ 10), which is the number of rounds of removal. The next m lines each contain one integer. The ith of these lines (1 ≤ i ≤ m) www.acmicpc.net • 풀이 코드 import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; imp.. 2023. 12. 11.
[백준] 25325 학생 인기도 측정 - Data Structure / Java • 문제 링크 25325번: 학생 인기도 측정 학생 이름이 공백으로 구분된 문자열 A가 주어진다. 문자열 A에는 중복된 학생 이름이 존재하지 않는다. 학생 이름은 알파벳 소문자로 이루어져 있다. 각 학생이 좋아하는 학생의 학생 이름 목록 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.Arrays; import java.util.Comparator; import java.util.HashMap; im.. 2023. 12. 10.
[백준] 2605 줄 세우기 - Data Structure / Java • 문제 링크 2605번: 줄 세우기 점심시간이 되면 반 학생 모두가 한 줄로 줄을 서서 급식을 탄다. 그런데 매일 같이 앞자리에 앉은 학생들이 앞에 줄을 서 먼저 점심을 먹고, 뒷자리에 앉은 학생들은 뒤에 줄을 서 늦게 점심을 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 { BufferedWriter bw = n.. 2023. 12. 9.
[백준] 1835 카드 - Data Structure / Java • 문제 링크 1835번: 카드 첫 번째 줄에 카드의 개수 N(1 ≤ N ≤ 1,000)이 주어진다. www.acmicpc.net • 풀이 코드 import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.util.ArrayDeque; import java.util.Deque; public class Main { public static void main(String[] args) throws IOException { BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); StringBuilder .. 2023. 12. 8.
[백준] 1351 무한 수열 - Data Structure / Java • 문제 링크 1351번: 무한 수열 첫째 줄에 3개의 정수 N, P, Q가 주어진다. www.acmicpc.net • 풀이 코드 import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.util.HashMap; import java.util.Map; public class Main { static long p, q; static Map map = new HashMap(); public static void main(String[] args) throws IOException { BufferedWriter bw = new BufferedWriter(new OutputStre.. 2023. 12. 7.