摘要: #include #include #include #include #include #define MAX 15000#define INF 9999999using namespace std;int n,sum=0;bool isBuild[150][150... 阅读全文
posted @ 2018-03-10 14:10 LandingGuys 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 根据spfa改,不知道为啥TE了, ...因为忘记每次循环将num=0 ,T_T 要注意是双向边,所以要加两次addEdge。 dijkstra 寻找最短路 prim最小生成树 虽然两者似乎看起来差不多(都是利用了贪心思想,找到最近的一点),但是更新的东西是完全不一样的 阅读全文
posted @ 2018-03-10 13:17 LandingGuys 阅读(99) 评论(0) 推荐(0) 编辑
摘要: #include #define INF 9999999using namespace std;int main(){ int e[51][51],book[50],dis[50],s,t,d,n,m;//n个城市,m条路 cin>>n>>m; ... 阅读全文
posted @ 2018-03-10 13:17 LandingGuys 阅读(39) 评论(0) 推荐(0) 编辑
摘要: #include #define INF 9999999using namespace std;int main(){ int e[51][51],s,t,d,n,m;//n个城市,m条路 cin>>n>>m; for(int i=1;i>s>>t>... 阅读全文
posted @ 2018-03-10 13:09 LandingGuys 阅读(88) 评论(0) 推荐(0) 编辑
摘要: 转自http://blog.csdn.net/cc_again/article/details/24841249补充几点:1. dp[0][0]=1; //初始状态 dp[0][1]=0; dp[0][2]=0; 为什么要这样初始,是因为第0个... 阅读全文
posted @ 2018-03-10 10:28 LandingGuys 阅读(118) 评论(0) 推荐(0) 编辑