Algorithm
-
algospot - firetrucksAlgorithm/알고스팟 2020. 1. 20. 05:58
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 //algospot - firetrucks #include #include #include using namespace std; #define INF 2000000000 int V, E, N, M; vector adj; vector firePlc; vector mini; void init() { cin >> V >..
-
algospot - clocksyncAlgorithm/알고스팟 2020. 1. 20. 05:53
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 //algospot - clocksync #include #include using namespace std; #define INF 33333 int arr[16]; int big(int x, int y) { return x > y ?..
-
최대공약수와 최소공배수 - 2609Algorithm/BOJ 2020. 1. 20. 05:49
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 //2609 #include using namespace std; int gcd(int x, int y) { while (true) { if (x == 0) return y; else if (y == 0) return x; else if (x > y) x = x % y; else y = y % x; } } int main() { int x, y; cin >> x >> y; int a = gcd(x, y); cout
-
algospot - galleryAlgorithm/알고스팟 2020. 1. 20. 05:44
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 //알고스팟 - GALLERY #include #include using namespace std; int V, E; vector adj; vector discovered; int ans; void init() { ans = 0; cin >> V >> E; adj = vector(V); discovered = vector(V..
-
Strongly Connected Component - 2150Algorithm/BOJ 2020. 1. 20. 05:36
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 //백준 SCC - 2150 #include #include #include #include #include using namespace std; int V, E; vector adj; vector discovered; vector sccId; priority_queue ..
-
tarjan's SCC algorithmAlgorithm/그래프 2020. 1. 20. 05:31
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 //타잔의 강결합 컴포넌트 분리 알고리즘 #include #include using namespace std; //그래프의 인접 리스트 표현 vector adj; //각 정점의 컴포넌트 번호, 컴포넌트 번호는 0부터 시작하며, //같은 강결합 컴포넌트에 속한 정점들의 컴포넌트 번호가 같다. vector sccId; //각 정점의 발견 순서 vector discovered; //정점의 번호를 담는 스택 stac..
-
algospot - hanoi4Algorithm/알고스팟 2020. 1. 17. 02:49
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 //algospot - hanoi4 #include #include #include using namespace std; int N; int last, state; int c[1 idx; state = set(state, idx-..