上一页 1 2 3 4 5 6 7 8 ··· 10 下一页
摘要: 点击查看代码 #include<cstdio> #include<vector> #include<algorithm> using namespace std; #pragma warning(disable:4996) /* prim算法与Dijkstra算法思想相同,只有d[]的定义不同: ( 阅读全文
posted @ 2022-09-30 22:50 zhaoo_o 阅读(10) 评论(0) 推荐(0) 编辑
摘要: 点击查看代码 #include<cstdio> #include<algorithm> using namespace std; #pragma warning(disable:4996) const int maxn = 201; //最多不超过200个顶点 const int INF = 0x3 阅读全文
posted @ 2022-09-30 22:49 zhaoo_o 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 点击查看代码 #include<cstdio> #include<vector> #include<queue> using namespace std; #pragma warning(disable:4996) const int maxn = 510; //最多不超过500个顶点 const 阅读全文
posted @ 2022-09-30 22:49 zhaoo_o 阅读(8) 评论(0) 推荐(0) 编辑
摘要: 点击查看代码 #include<cstdio> #include<vector> using namespace std; #pragma warning(disable:4996) const int maxn = 510; //最多不超过500个顶点 const int INF = 0x3fff 阅读全文
posted @ 2022-09-30 22:48 zhaoo_o 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 点击查看代码 #include<cstdio> #include<vector> #include<algorithm> using namespace std; #pragma warning(disable:4996) /* 针对存在多条最短路径的情况,迪杰斯特拉算法的优化模板: 1、先在迪杰斯 阅读全文
posted @ 2022-09-30 22:48 zhaoo_o 阅读(32) 评论(0) 推荐(0) 编辑
摘要: 点击查看代码 #include<cstdio> #include<vector> #include<algorithm> using namespace std; #pragma warning(disable:4996) //迪杰斯特拉算法伪代码 dijkstra(G, d[], s) { //图 阅读全文
posted @ 2022-09-30 22:47 zhaoo_o 阅读(66) 评论(0) 推荐(0) 编辑
摘要: 点击查看代码 #include<cstdio> #include<vector> #include<queue> using namespace std; #pragma warning(disable:4996) const int maxn = 1010; //最多1000个顶点 const i 阅读全文
posted @ 2022-09-30 21:15 zhaoo_o 阅读(47) 评论(0) 推荐(0) 编辑
摘要: 点击查看代码 #include<cstdio> #include<vector> using namespace std; #pragma warning(disable:4996) const int maxn = 100; //最多有100个顶点 const int INF = 1000000; 阅读全文
posted @ 2022-09-30 21:14 zhaoo_o 阅读(32) 评论(0) 推荐(0) 编辑
摘要: 点击查看代码 /* 有n堆果子,每堆果子的质量已知,现在需要把这些果子合并成一堆,但是每次只能把两堆果子合并到一起,同时会消耗与两堆果子质量之和等值的体力。 显然,在进行n-1轮后,就只剩一堆了。为了尽可能节省体力,请设计出合并的次序方案,使得耗费的体力最少,并给出消耗的体力值 输入样例: 5 1 阅读全文
posted @ 2022-09-30 21:13 zhaoo_o 阅读(54) 评论(0) 推荐(0) 编辑
摘要: 点击查看代码 /* 输入样例: 10 20 30 90 40 70 60 80 10 100 50 */ #include<cstdio> #include<algorithm> using namespace std; #pragma warning(disable:4996) const int 阅读全文
posted @ 2022-09-30 21:12 zhaoo_o 阅读(12) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 10 下一页