摘要: 给定n个点的带权路径,求0到n-1的最短哈密顿通路,使用位运算以及动态规划的思想进行精确计算,实际上算法能处理的结点数量大约在20个,如果只需要获得 比较优的解可以通过神经网络、模拟退火等最优化理论的算法进行搜索。 代码如下: #include<iostream> #include<string.h 阅读全文
posted @ 2020-06-13 23:16 WA自动机~ 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1710 通过先序以及中序遍历建树并且输出后序遍历的结果。 代码如下: #include<bits/stdc++.h> using namespace std; typedef unsigned int u 阅读全文
posted @ 2020-06-13 21:43 WA自动机~ 阅读(219) 评论(0) 推荐(0) 编辑