摘要:
题解:根据《具体数学》上关于迭代约瑟夫问题性质的总结如下:多次迭代的约瑟夫问题的解具有循环移位性质,且答案最终会收敛到不动点处。 代码如下 cpp include using namespace std; const int maxn=1e5+10; int dp[maxn],n,ans; void 阅读全文
摘要:
题目大意:给定一个四个柱子的汉诺塔,N 个盘子,求最少多少步移动到另一个柱子上。 题解:$f[n]=min(2 f[i]+d[n i])$,其中 $d[i]$ 为汉诺三塔最小移动次数。M 塔同理。 代码如下 cpp include using namespace std; const int max 阅读全文