摘要:
Floyd-Warshall算法的原理是动态规划。 设Di,j,k为从i到j的只以(1..k)集合中的节点为中间节点的最短路径的长度。 若最短路径经过点k,则Di,j,k = Di,k,k − 1 + Dk,j,k − 1; 若最短路径不经过点k,则Di,j,k = Di,j,k − 1。 因此,D 阅读全文
摘要:
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<string.h> #define N 1005 #define MAX 100000 int n, ans, A[N][N], dis[N], vis[N]; void Prim( 阅读全文
摘要:
#define _CRT_SECURE_NO_WARNINGS #include<cstdio> #include<cstring> #include<algorithm> using namespace std; #define N 100005 int p[N]; struct Edge { i 阅读全文
摘要:
Implement regular expression matching with support for '.' and '*'. '.' Matches any single character. '*' Matches zero or more of the preceding elemen 阅读全文
摘要:
There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity sh 阅读全文