본문 바로가기

코딩 문제 풀이52

[백준] 자바 문제 풀이 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.
[백준] 자바 문제 풀이 13904 : 골드3 import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.PriorityQueue; import java.util.StringTokenizer; public class Main { static class Hw implements Comparable{ int d; int w; public Hw(int d, int w) { this.d = d; this.w = w; } @Override public int compareTo(H.. 2023. 9. 20.
[백준] 자바 문제 풀이 20040 : 골드4 import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { static int[] parent; public static boolean union(int x, int y) { x = find(x); y = find(y); if(x == y) return false; if(x 2023. 9. 20.
[백준] 자바 문제 풀이 16562 : 골드4 import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.HashMap; import java.util.StringTokenizer; public class Main { static int[] parent; public static boolean union(int x, int y) { x = find(x); y = find(y); if (x == y) return false; if (x clist[i]) { map.put(root, clist[i]); } } else { map.put(root, clist[i]); } } int total = 0; for(Integer k.. 2023. 9. 20.
[백준] 자바 문제 풀이 3190 : 골드4 import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayDeque; import java.util.Deque; import java.util.StringTokenizer; public class Main { static class Point{ int x; int y; public Point(int x, int y) { this.x = x; this.y = y; } } public static void main(String[] args) throws Exception { // TODO Auto-generated method stub BufferedReader br = new BufferedReader(new.. 2023. 9. 19.
728x90
반응형