#include #include #include #include #include #include #include #include using namespace std; vector> hand; int score; int modif; void A() {} //decltype(A) lastf; std::function lastf; // desitka je repre nulou int card_score(char c) { if(c>='2' && c<='9') return c-'0'; return 10; } void r1() { score++; int js=0; for(auto && p: hand) { if(p.first=='J') js++; } score+=card_score(hand[0].first)*js; } void r2() { // no need to compute score*=2; } void r3() { vector count(4); for(auto && p: hand) { switch(p.second) { case 'D': count[0]++; break; case 'H': count[1]++; break; case 'C': count[2]++; break; case 'S': count[3]++; break; } } score*=2; for(auto && p: count) { if(p==0) { score/=2; break; } } } void r4() { vector count(4); for(auto && p: hand) { switch(p.second) { case 'D': count[0]++; break; case 'H': count[1]++; break; case 'C': count[2]++; break; case 'S': count[3]++; break; } } score+=abs((count[0]+count[1])-(count[2]+count[3])); } void r5() { // ignore } void r6() { int count=0; for(auto && p: hand) { if(p.first=='7') count++; } if(count==4) score-=11*11; } void r7() { if(score>=0) { int add=card_score(hand[0].first); for(auto && p: hand) { add=min(add, card_score(p.first)); } score+=add; } } void r8() { if(score<0) score*=-1; } void r9() { int diamonds=0; for(auto && p: hand) { if(p.second=='D') diamonds++; } if(diamonds>=3) { score++; for(int i=0;i<5;i++) { if(hand[i].first=='2') hand[i].first='5'; else if(hand[i].first=='5') hand[i].first='2'; else if(hand[i].first=='9') hand[i].first='6'; else if(hand[i].first=='6') hand[i].first='9'; } } } void r10() { auto handtmp=hand; sort(handtmp.begin(), handtmp.end()); bool ok=true; for(int i=0;i<4;i++) { //cout<8) { int ones=0; int sct=score; for(int i=0; i<32; i++) { if(sct%2==1) ones++; sct>>=1; } score+=ones; }*/ } void r12() { for(auto && p: hand) { if(p.first=='2') { lastf(); break; } } } void r13() { for(auto && p: hand) { if(p.first=='2') { score*=2; break; } } } void r14() { } int main(int argc, char * * argv) { char a,b; for(int i=0; i<5; i++) { cin>>a>>b; if(b=='0') { a='0'; cin>>b; } hand.push_back({a,b}); //cout<>a; } modif=0; int t; score = 0; for(auto && p:hand) { score += card_score(p.first); } t=score; r1(); if(t!=score) { modif++; lastf=r1; } t=score; //count<