#include int round[5]; int best[8192][64]; int predk[8192][64], predm[8192][64]; int cat[13]; int nbits[8192]; int cmp(int *a, int *b){ if (*a<*b) return -1; if (*a>*b) return +1; return 0; } main(){ int i,j; register k,m,mask; for (k=0;k<8192;k++){ mask = 0; for (m=0;m<13;m++){ mask += (k & (1< 63) newtop = 63; if (newscore > best[k|mask][newtop]) { best[k|mask][newtop] = newscore; predk[k|mask][newtop] = k; predm[k|mask][newtop] = m; } } } } } { int bestk=8191,bestm=63,bonus=35; j = bonus + best[8191][63]; for (i=0;i<63;i++) if (best[8191][i] > j) { j = best[8191][i]; bestm = i; bonus = 0; } while (bestk) { int x = bestk ^ predk[bestk][bestm]; for (i=0;x>>=1;i++){} cat[i] = best[bestk][bestm] - best[predk[bestk][bestm]][predm[bestk][bestm]]; x = predk[bestk][bestm]; bestm = predm[bestk][bestm]; bestk = x; } for (i=0;i<13;i++) printf("%d ",cat[i]); printf("%d %d\n",bonus,j); } } }