提交时间:2023-10-04 10:38:26

运行 ID: 104879

#include <iostream> #include <cmath> using namespace std; int a[35]; int main() { int n; cin >> n; a[1] = 3; a[2] = 7; for(int i = 3;i <= n;i++) a[i] = 2 * a[n - 1] + a[n - 2]; cout << a[n]; return 0; }