这个手机号码是11位的,搜索空间很小,用普通的搜索就行了:(pos1, pos2, index) = Min(dis(pos1, telnum[index]) + (telnum[index], pos2, index+1) /*第一个机械臂从pos1移动到telnum[index]*/,dis(pos2, telnum[index]) + (pos1, telnum[index], index+1)) /*或者第二个机械臂从pos2移动到telnum[index]*/ ; (pos1, pos2, 11) = 0。 (其中dis函数是两个按键的移动消耗,O(1)的复杂度),然后可能会出现重复计算,那么就加个记忆set保存计算过的结果,还有(pos1, pos2, index) == (pos2, pos1, index)。
点赞 2

相关推荐

牛至超人:哈工大已经很棒了,不需要加括号了,然后咋没有实习经历呢?火速趁寒假整一段实习,导师不让就狠狠肘击
投了多少份简历才上岸
点赞 评论 收藏
分享
想run的马里奥在学...:这个学历帮你扫平百分之80的障碍,投就完了,这会找不到就等3月暑期一样能找到
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务