본문 바로가기

전체 글24

플로이드 워셜 (Floyd Warshall) public class Floyd_Warshall { static final int _M_size_ = 100; // max number of vertices static final int _INTMAX_ = 1000000000; // infinite static int AdjMatrix[][] = new int[_M_size_][_M_size_]; // Adjacent matrix static int dist[][] = new int [_M_size_][_M_size_]; // Shortest distance matrix static void floyd_warshall(int V) { for(int i = 1 ; i 2018. 7. 17.
[BOJ 10942] 팰린드롬? https://www.acmicpc.net/problem/10942 import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.StringTokenizer; public class Main_10942 { /* * 팰린드롬? * https://www.acmicpc.net/problem/10942 */ static int[] a; static int N; public static void main(S.. 2018. 7. 17.
다익스트라 (Dijkstra) import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.PriorityQueue; import java.util.StringTokenizer; public class Main_1753 { /* * 최단경로 * https://www.acmicpc.net/problem/1753 * Dijkstra */ .. 2018. 7. 17.
DFS (Stack) package graph; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.Iterator; import java.util.Stack; import java.util.StringTokenizer; public class DFS_stack { /* * DFS, BFS */ public static void main(String[] args.. 2018. 7. 17.