#include #include #include #include #include #include #include #include using namespace std; #define SIZE(s) int((s).size()) #define REP(i,n) for (int i=0; i<(n); i++) long long X[500]; int roll[500]; int mam[6]; inline int process(int type) { if (type<6) { int res = 0; REP(i,5) if (mam[i]==type+1) res += type+1; return res; } if (type==6) { bool c12345 = true; REP(i,5) if (mam[i]!=i+1) c12345 = false; bool c23456 = true; REP(i,5) if (mam[i]!=i+2) c23456 = false; if (c12345 || c23456) return 30; return 0; } int sum = 0; REP(i,5) sum += mam[i]; if (type==7) { if (mam[0]==mam[1] && mam[3]==mam[4] && mam[0]!=mam[4] && mam[2]==mam[1]) return sum; if (mam[0]==mam[1] && mam[3]==mam[4] && mam[0]!=mam[4] && mam[2]==mam[3]) return sum; return 0; } if (type==8) { if (mam[0]==mam[1] && mam[1]==mam[2] && mam[2]==mam[3] && mam[3]!=mam[4]) return sum; if (mam[0]!=mam[1] && mam[1]==mam[2] && mam[2]==mam[3] && mam[3]==mam[4]) return sum; return 0; } if (type==9) { if (mam[0]==mam[1] && mam[1]==mam[2] && mam[2]==mam[3] && mam[3]==mam[4]) return 50; return 0; } if (type==10) return sum; return -987654321; } int memo[200][2050]; int ppayoff[200][16][12]; void doit() { int ber[16]; for (int zac=1; zac<=180; zac++) for (int typ=0; typ<11; typ++) { for (int kolko=5; kolko<=15; kolko++) ppayoff[zac][kolko][typ] = 0; REP(prve,1<<5) { int p = __builtin_popcount(prve); REP(druhe,1<<(5-p)) { int d = __builtin_popcount(druhe); int t = 5-p-d; int kolko = 15 - 2*p - d; int z = 0; REP(i,5) if (prve & 1<= 0) return memo[zac][remains]; int &res = memo[zac][remains]; res = 0; for (int k=5; k<=15; k++) for (int p=0; p<11; p++) if (remains & 1<> 16) % 6); memset(memo,-1,sizeof(memo)); doit(); printf("%d\n",solve(1,(1<<11)-1)); } }