简单递推
#include<stdio.h>
int n,a[21]={0,0,1,1};
int main(){
scanf("%d",&n);
for(int i=4;i<=n;i++) a[i]=a[i-3]+2*a[i-2]+a[i-1];
printf("%d",a[n]);
}
简单递推
#include<stdio.h>
int n,a[21]={0,0,1,1};
int main(){
scanf("%d",&n);
for(int i=4;i<=n;i++) a[i]=a[i-3]+2*a[i-2]+a[i-1];
printf("%d",a[n]);
}