题解
2023-08-21 09:18:40
发布于:广东
1阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
long long a[60] = {0,3,6,6};
int main() {
	int n;
	cin >> n;
    if(n==1) // 一定一定要有这一行
    {
        cout<<0;
        return 0;
    }
	for(int i = 4; i <= n; i++) {
		a[i] = a[i-1] + 2 * a[i-2];
	} 
	cout << a[n];
	return 0;
}
这里空空如也


有帮助,赞一个