C. Blocked Points 题意:A点和B点是4-connected,的条件是 the Euclidean distance between A and B is one unit and neither A nor B is blocked; or there is some integral point C, such that A is 4-connected with C,
题意 输出n个盘子在4个塔的汉诺塔问题最少要多少步。 思路 我们设f[n]为n个盘子在4塔的汉诺塔问题下需要的最少步数,d[i]为i个盘子在3塔的汉诺塔问题下需要的最少步数,可以得出动态转移方程: f[n]=min(2∗f[i]+d[n−i]) f [ n ] = m i n ( 2 ∗ f [ i ] + d [ n − i ] ) f[n]=min(2*f[i]+d[n-i])
Hanoi 双塔问题 \operatorname{Hanoi\ 双塔问题} Hanoi 双塔问题 题目链接: luogu P1096 \operatorname{luogu\ P1096} luogu P1096 题目 给定 A A A 、 B B B 、 C C C 三根足够长的细柱,在 A A A 柱上放有 2 n 2n 2n 个中间有孔的圆盘,共有 n n n 个