본문 바로가기

algorithm20

[JAVA] SWEA 1251 하나로 [Kruskal] 전체 코드 import java.util.ArrayList; import java.util.Arrays; import java.util.PriorityQueue; import java.util.Scanner; public class SWEA_1251_하나로 { static int N, T; static double E; static int arr[], sel[]; static boolean v[]; static ArrayList arrList; static int parent[]; static PriorityQueue pq; static class Vector implements Comparable { // 시작점과 끝점 그리고 비용을 담는 클래스 int start, end; long weight; Ve.. 2020. 8. 19.
[JAVA] SWEA 1238 Contact [BFS] 전체 코드 import java.util.ArrayList; import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; public class SWEA_1238_Contact { public static void main(String[] args) { int T = 10, N, start, x, y; Scanner sc = new Scanner(System.in); ArrayList[] arr; for(int test_case=1; test_case 2020. 8. 18.
[JAVA] 백준 14888 연산자끼워넣기 전체 코드 import java.util.Scanner; public class 백준_14888_연산자끼워넣기 { static int N; static int op[] = new int[4]; static int MAX = Integer.MIN_VALUE, MIN = Integer.MAX_VALUE; public static void main(String[] args) { Scanner sc = new Scanner(System.in); N = sc.nextInt(); int[] arr = new int[N]; for (int i = 0; i < N; i++) { // 숫자 배열 arr[i] = sc.nextInt(); } for (int i = 0; i < 4; i++) { // 연산자 배열 op[i].. 2020. 8. 17.
[JAVA] SWEA 1226 미로1 [BFS, DFS] 전체 코드 import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; public class SWEA_1226_미로1 { static int[] dy = { 1, -1, 0, 0 }; //상, 하, 우, 좌 static int[] dx = { 0, 0, 1, -1 }; static int chk; //도달유무 체크값 static class Point{ // bfs 사용시 필요한 좌표 클래스 int y, x; Point(int y, int x){ this.y = y; this.x = x; } } public static void main(String[] args) { Scanner sc = new Scanner(System... 2020. 8. 17.