Problem Solving1242 [백준] 31217 Y - Graph Theory / Java • 문제 링크 31217번: Y 첫 번째 줄에 정점의 개수 $n$과 간선의 개수 $m$이 공백으로 분리되어 주어집니다. ($1 \le n \le 10^5$, $0 \le m \le \min(\frac{n(n-1)}{2},2\times 10^5)$) 두 번째 줄부터 $m$개의 줄에 $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 Bu.. 2024. 2. 5. [백준] 18422 Emacs - Graph Theory / Java • 문제 링크 18422번: Emacs While playing in his favourite text editor, Daniel decided to draw a picture that was N characters high and M characters wide. The picture consists solely of characters ’.’ and ’*’ such that characters ’*’ form some non-overlapping rectangles. www.acmicpc.net • 풀이 코드 import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.Inp.. 2024. 2. 4. [백준] 4351 Hay Points - Data Structure / Java • 문제 링크 4351번: Hay Points The first line of input contains 2 positive integers: m 0) { int sum = 0; String s; while (!(s = br.readLine()).equals(".")) { st = new StringTokenizer(s); while (st.hasMoreTokens()) sum += map.getOrDefault(st.nextToken(), 0); } sb.append(sum).append("\n"); } bw.write(sb.toString()); bw.flush(); } } 2024. 2. 3. [백준] 7587 Anagrams - Data Structure / Java • 문제 링크 7587번: Anagrams Output consists of one word from each list, the word with the most anagrams within the list, followed by a space, followed by the number of anagrams. The word displayed will be the first occurrence in the list of the anagram. If more than one word has the www.acmicpc.net • 풀이 코드 import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; impo.. 2024. 2. 2. [백준] 28445 알록달록 앵무새 - Data Structure / Java • 문제 링크 28445번: 알록달록 앵무새 재현이가 키우는 앵무새 포포와 레몬이는 그동안 새끼들을 참 많이도 낳았다. 그렇게 태어난 앵무새들을 관찰하며 재현이는 앵무새들의 색에 간단한 규칙이 있다는 것을 발견했다. 그것은 바로 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.Set; import java.util.StringTokenizer; import java.util.TreeSet; publi.. 2024. 2. 1. [백준] 14769 Stacking Cups - Data Structure / Java • 문제 링크 14769번: Stacking Cups The first line of the input file contains an integer N, the number of cups (1 ≤ N ≤ 20). Next N lines will contain two tokens each, either as “color radius” or “diameter color”. The radius of a cup R will be a positive integer less than 1000. T www.acmicpc.net • 풀이 코드 import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import ja.. 2024. 1. 31. 이전 1 ··· 97 98 99 100 101 102 103 ··· 207 다음