上一页 1 2 3 4 5 6 7 8 9 ··· 15 下一页
摘要: class Solution { public int removeBoxes(int[] boxes) { int n = boxes.length; int[][][] dp = new int[n][n][n]; // dp[i][j][k] 从i到j的盒子j右面右连续的等于第j个盒子颜色有k 阅读全文
posted @ 2020-08-15 15:51 Sexyomaru 阅读(140) 评论(0) 推荐(0) 编辑
摘要: class Solution { int index = 0; public int calculate(String s) { int n = s.length(); Stack<Integer> stack = new Stack(); char pre = '+'; int num = 0; 阅读全文
posted @ 2020-08-14 20:15 Sexyomaru 阅读(113) 评论(0) 推荐(0) 编辑
摘要: class Solution { public boolean containsNearbyAlmostDuplicate(int[] nums, int k, int t) { int n = nums.length; TreeSet<Integer> set = new TreeSet<>(); 阅读全文
posted @ 2020-08-14 19:53 Sexyomaru 阅读(84) 评论(0) 推荐(0) 编辑
摘要: class Solution { public List<List<Integer>> getSkyline(int[][] buildings) { List<List<Integer>> res = new ArrayList<>(); Node[] nodes = new Node[build 阅读全文
posted @ 2020-08-14 17:32 Sexyomaru 阅读(140) 评论(0) 推荐(0) 编辑
摘要: #include <bits/stdc++.h> using namespace std; const int N = 550, M = 100010; int h[N], e[M], ne[M], idx; int match[N]; bool st[N]; int n1, n2, m; void 阅读全文
posted @ 2020-08-13 20:24 Sexyomaru 阅读(168) 评论(0) 推荐(0) 编辑
摘要: #include <bits/stdc++.h> using namespace std; const int N = 100010; int h[N], e[N], ne[N], w[N], idx; int color[N]; int n, m; void add(int a, int b, i 阅读全文
posted @ 2020-08-13 16:35 Sexyomaru 阅读(112) 评论(0) 推荐(0) 编辑
摘要: #include <bits/stdc++.h> using namespace std; const int N = 200020; int p[N]; int n, m; struct Edge { int a, b, w; bool operator< (const Edge &W) cons 阅读全文
posted @ 2020-08-13 10:47 Sexyomaru 阅读(97) 评论(0) 推荐(0) 编辑
摘要: #include <bits/stdc++.h> using namespace std; const int N = 550, M = 100010, INF = 0x3f3f3f3f; int g[N][N], dist[N]; // dist存点到(最小生成树的点集合)的最小距离 bool s 阅读全文
posted @ 2020-08-12 21:34 Sexyomaru 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 分析: f[i, j, k]表示从i走到j的路径上除i和j点外只经过1到k的点的所有路径的最短距离。那么f[i, j, k] = min(f[i, j, k - 1), f[i, k, k - 1] + f[k, j, k - 1]。 因此在计算第k层的f[i, j]的时候必须先将第k - 1层的所 阅读全文
posted @ 2020-08-12 20:22 Sexyomaru 阅读(68) 评论(0) 推荐(0) 编辑
摘要: #include <bits/stdc++.h> using namespace std; const int N = 10010; int h[N], e[N], ne[N], w[N], idx; int dist[N], cnt[N]; bool st[N]; int n, m; void a 阅读全文
posted @ 2020-08-12 20:10 Sexyomaru 阅读(113) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 15 下一页