본문 바로가기
728x90

코딩 문제 풀이/백준44

[백준] 자바 문제 풀이 1715 : 골드4 BOJ 1715 풀이 코드 import java.io.*; import java.util.PriorityQueue; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws Exception { BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); PriorityQueue pq = new Priorit.. 2023. 9. 22.
[백준] 자바 문제 풀이 12837 : 골드1 BOJ 12837 풀이 코드 import java.io.*; import java.util.*; public class Main { static class SegmentTree { private long[] tree; SegmentTree(int n) { double treeHeight = Math.ceil(Math.log(n)/Math.log(2))+1; long treeNodeCount = Math.round(Math.pow(2, treeHeight)); tree = new long[Math.toIntExact(treeNodeCount)]; } long init(long[] arr, int node, int start, int end) { if(start == end) { return tree[nod.. 2023. 9. 22.
[백준] 자바 문제 풀이 9935 : 골드4 BOJ 9935 : Stack & Deque import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader((System.in))); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); String str = br.readLine(); String bomb = br.readLine(); char b = bomb.charAt(bomb.length() - 1); Deque d.. 2023. 9. 22.
[백준] 자바 문제 풀이 13334 : 골드2 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Comparator; import java.util.PriorityQueue; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = .. 2023. 9. 21.
[백준] 자바 문제 풀이 1939 : 골드3 import java.util.*; import java.io.*; public class Main { static int n, m; static int start, end; static int left = 0, right = 0; static int ans; static List[] board = new ArrayList[10001]; static boolean[] visited = new boolean[10001]; static class Graph { int dest; int weight; Graph(int dest, int weight) { this.dest = dest; this.weight = weight; } } static boolean dfs(int s, int e, int w) { vi.. 2023. 9. 21.
[백준] 자바 문제 풀이 2812 : 골드3 import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { // TODO Auto-generated method stub BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); StringTokenizer str = new StringTokenizer(br.readLine(), " "); int n = Integer.parseInt(str.nextT.. 2023. 9. 21.
[백준] 자바 문제 풀이 17298 : 골드4 import java.io.*; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws Exception { BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int[] nlist = new int[n]; StringTokenizer str = new StringTokenizer(br.readLi.. 2023. 9. 21.
[백준] 자바 문제 풀이 16724 : 골드3 import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer str = new StringTokenizer(br.readLine()); int n = Integer.parseInt(str.nextToken()); int m = Integer.parseInt(str.ne.. 2023. 9. 21.
[백준] 자바 문제 풀이 4195 : 골드2 import java.util.*; import java.io.*; public class Main { static int num = 0; static Map name = new HashMap(); static int[] parent; static int[] count; public static boolean union(int x, int y) { x = find(x); y = find(y); if(x == y) return false; if(x 2023. 9. 21.
[백준] 자바 문제 풀이 10216 : 골드4 import java.util.*; import java.io.*; public class Main { static int[] parent; static class Point { int x; int y; int r; Point(int x, int y, int r) { this.x = x; this.y = y; this.r = r; } } public static boolean union(int x, int y) { x = find(x); y = find(y); if(x == y) return false; if(x 2023. 9. 20.
[백준] 자바 문제 풀이 1918 : 골드2 import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.Stack; public class Main { public static boolean is_Op(char c) { if (c == '*' || c == '/' || c == '+' || c == '-' || c == '(' || c == ')') return true; return false; } public static int compareOp(char a, char b) { switch (a) { case '-': case '+': if (b == '-' || b .. 2023. 9. 20.
[백준] 자바 문제 풀이 17144 : 골드4 import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { // TODO Auto-generated method stub BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] s = br.readLine().split(" "); int r = Integer.parseInt(s[0]); int c = Integer.parseInt(s[1]); int t = Integer.parseInt(s[2]); int[][] dus.. 2023. 9. 20.
728x90
반응형