C++ solution to the problem


#1

int dp[A+1];
for(int i=0;i<=A;i++)
dp[i]=0;
dp[0]=1;dp[1]=1;
for(int i=2;i<=A;i++){
for(int j=0;j<i;j++){
dp[i]+=dp[j]*dp[i-j-1];
}
}
return dp[A];