#include <stdio.h>
int dp[31];
int bottom_up(int n) {
    dp[0]=1;
    dp[1]=0;
    dp[2]=3;
    for(int i=3; i<=n; i++) {
        if(i%2!=0) {
            dp[i]=0;
            continue;
        }
        for(int j=1; j<=i/2; j++) {
            if(j==1) dp[i]+=dp[i-2]*3;
            else dp[i]+=dp[i-2*j]*2;
        }
    }
    return dp[n];
}

int main() {
    int n;
    scanf("%d",&n);
    printf("%d",bottom_up(n));
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: