본문 바로가기

나는 오늘,

(371)
외판원 순회 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 #include #include #define MAXX 17 #define INF 987654321 using namespace std; int n; int w[MAXX][MAXX], dp[MAXX][1
전구 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 #include #include #define MAXX 201 using namespace std; int dp[MAXX][MAXX]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; //k개의 색으로 바꿀 수 있다. int color[MAXX] = {0}; for (int i = 1; i > color[i]; for (int i = 1; i
공통부분문자열 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 #include #include #include #define MAXX 4001 using namespace std; int dp[MAXX][MAXX]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); string s, s2; cin >> s >> s2; int ans = 0; if (s[0] == s2[0]) dp[0][0] = 1; for (int i = 1; i
[BOJ] 11049. 행렬 곱셈 순서 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 #include #include #define MAXX 501 using namespace std; typedef pair pp; typedef long long ll; int dp[MAXX][MAXX]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector matrix[MAXX]; for (int i = 1; i > r >> c; matrix[i].push_back(pp(r, c)); }..
가장 긴 증가하는 부분 수열5 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 #include #include #include #define MAXX 1000001 using namespace std; typedef long long ll; ll a[MAXX], res[MAXX]; typedef pair pp; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; for (int..
가장 큰 정사각형 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 #include #include #include #define MAXX 1002 using namespace std; int map[MAXX][MAXX], dp[MAXX][MAXX]; int n, m; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> m; for (int i = 1; i > s; for (int j = 0; j
오목 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 94 95 96 97 98 99 100 #include #include #define MAXX 21 using namespace std; int map[MAXX][MAXX]; int dx[4] = {0, 1, 1, 1}, dy[4..
k번째 최단경로 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 #include #include #include #include #include #include #include #define MAXX 1001 #define INF 987654321 using namespace std; typedef pair pp; vector edges[M..