Waca loves maths,.. a lot. He always think that 1 is an unique number. After playing in hours, Waca suddenly realize that every integer can be represented by digit '1', plus operator and minus operator. For example, 1534 can be represented as 1111 +…
目录 Meet in the Middle 总结 1.算法模型 1.1 Meet in the Middle算法的适用范围 1.2Meet in the Middle的基本思想 1.3Meet in the Middle的算法过程 1.4Meet in the Middle的时间复杂度分析 2.代码实现 例题 [SPOJ ABCDEF] 法1: 结果合并法 法2:哈希表 法3:map 3.扩展运用 [BZOJ 4800] 冰球世界锦标赛 [POJ 1186] 方程的解数 [BZOJ 2679]…
非常好的题!和spoj 的 Mobile Service有点相似,用记忆化搜索很容易解决 看了网上的题解,也是减掉一维,刚好可以开下数组 https://blog.lucien.ink/archives/224/ #include<bits/stdc++.h> using namespace std; #define maxn 2005 int n,A[maxn],B[maxn]; ][][][]; //状态:准备去拉第i个人,当前在cur楼,另外三个人的目标楼层是abc int dfs(in…