提交时间:2023-10-04 09:11:17

运行 ID: 104764

#include <iostream> #include <algorithm> #include <cstdio> #include <cmath> using namespace std; long long f[35]; int n; int main() { scanf("%d", &n); f[1] = 3; f[2] = 7; for (int i = 3;i <= n;i++) f[i] = f[i - 2] + 2 * f[i - 1]; printf("%d", f[n]); return 0; }