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

运行 ID: 104881

#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[i - 1] + a[i - 2]; cout << a[n]; return 0; }