We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
please could you provide the code to build the 3 dimensional 'dp' table.
thanks :-)
The text was updated successfully, but these errors were encountered:
Here is the source code that I used for generating the 'dp' table.
static int dp[5][14][8]; static int choose[53][8]; int init(void) { int i; int j; int k; int l; /* choose */ memset(choose, 0, sizeof(choose)); for (i=0; i<=52; i++) { choose[i][0] = 1; choose[i][1] = i; choose[i][i] = 1; } for (i=1; i<=52; i++) { for (j=2; j<=7 && j<=i; j++) { choose[i][j] = choose[i-1][j] + choose[i-1][j-1]; } } /* quinary */ memset(dp, 0, sizeof(dp)); for (i=0; i<=7; i++) { if (i >= 5) dp[1][1][i] = 0; else dp[1][1][i] = 1; dp[1][0][i] = 0; } for (i=1; i<=13; i++) { dp[1][i][1] = i; dp[1][i][0] = 1; } for (i=2; i<=13; i++) { for (j=2; j<=7; j++) { int sum = 0; for (k=0; k<=4 && k<=j; k++) { sum += dp[1][i-1][j-k]; } dp[1][i][j] = sum; } } for (l=2; l<=4; l++) { for (i=1; i<=13; i++) { for (j=0; j<=7; j++) { if (j >= l-1) dp[l][i][j] = dp[l-1][i][j] + dp[1][i][j-l+1]; else dp[l][i][j] = dp[l-1][i][j]; } } } return 0; }
Sorry, something went wrong.
No branches or pull requests
Hi,
please could you provide the code to build the 3 dimensional 'dp' table.
thanks :-)
The text was updated successfully, but these errors were encountered: