96. 奇怪的汉诺塔 - AcWing题库高质量的算法题库https://www.acwing.com/problem/content/description/98/
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <cstring>
#include <set>
#include <cmath>
#include <map>
#include <cstdlib>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
const int MN = 65005;
const int MAXN = 2000010;
const int INF = 0x3f3f3f3f;
#define IOS ios::sync_with_stdio(false)
int n;
int three[MAXN];
int four[MAXN];
int main() {
memset(three, INF, sizeof(three));
memset(four, INF, sizeof(four));
n=12;
three[1] = 1;
for (int i = 2; i <= n; i++) {
three[i] = min(three[i], three[i - 1] * 2 + 1);
}
four[1] = 1;
four[0] = 0;
for (int i = 2; i <= n; i++) {
for (int j = 0; j < i; j++) {
four[i] = min(four[i], 2 * four[j] + three[i - j]);
}
}
for(int i=1;i<=n;i++){
printf("%d\n",four[i]);
}
return 0;
}