提交时间:2023-10-05 08:24:39

运行 ID: 105024

#include<iostream> using namespace std; long long a[31]; int main() { long long 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]; }