Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Help me...I'm in stuck... Source: #include <stdio.h> int dynamic[3][3][38][15]; int total[3][3][38]; int n, m, k; void calc() { int i, j, k, l; for (i = 0;i < 3;i++) { for (l = 1;l < 3;l++) { dynamic[i][l][1][1] = 1; for (j = 1;j < 37;j++) { for (k = 1;k <= i + 11;k++) total[i][l][j] += dynamic[i][l][j][k]; for (k = 1;k <= i + 10;k++) { dynamic[i][l][j + 1][k + 1] += dynamic[i][l][j][k]; if (total[i][l][j] > 100) continue; if (7 <= k && k <= 8) dynamic[i][l][j + 1][1] += dynamic[i][l][j][k]; else if (9 <= k && k <= 8 + l) dynamic[i][l][j + 1][1] += dynamic[i][l][j][k] * 2; } } } } } int main() { calc(); for (;;) { scanf("%d", &n); if (n == -1) break; scanf(",%d,%d", &m, &k); printf("%d,%d,%d: %d\n", n, m, k, total[n - 10][m][k + 1]); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator