比赛 20150714B 评测结果 AAAAAAAAAA
题目名称 拱猪计分 最终得分 100
用户昵称 ミント 运行时间 0.008 s
代码语言 C++ 内存使用 0.29 MiB
提交时间 2015-07-14 11:24:09
显示代码纯文本
#include <cstdio>

const int heart[14] = {0, -50, -2, -3, -4, -5, -6, -7, -8, -9, -10, -20, -30, -40};
int score[4], numcard, now, temp;
bool pig, sheep, bianyaqi;
char c;

int main() 
{
    freopen("heart.in","r",stdin);
    freopen("heart.out","w",stdout);
    do {
        temp = 0;
        for(int i=0; i<4; i++) {
            score[i] = 0;
            pig = sheep = bianyaqi = false;
            scanf("%d", &numcard); temp += numcard;
            for(int j=0; j<numcard; j++) {
                do scanf("%c", &c); while(c == ' ');
                scanf("%d", &now);
                if(c == 'S' && now == 12) pig = true;
                if(c == 'D' && now == 11) sheep = true;
                if(c == 'C' && now == 10) bianyaqi = true;
                if(c == 'H') score[i] += heart[now];
            }
            scanf("\n");
            if(numcard == 1 && bianyaqi)
                score[i] = 50;
            else if(score[i] != -194) {
                if(pig) score[i] -= 100;
                if(sheep) score[i] += 100;
                if(bianyaqi) score[i] *= 2;
            } else {
                score[i] = 200;
                if(pig && sheep) score[i] = 500;
                else {
                    if(pig) score[i] -= 100;
                    if(sheep) score[i] += 100;
                }
                if(bianyaqi) score[i] *= 2;
            }
        }
        if(temp != 0) {
            for(int i=0; i<3; i++)
                if(score[i] > 0)
                    printf("+%d ", score[i]);
                else
                    printf("%d ", score[i]);
            if(score[3] > 0)
            printf("+%d\n", score[3]);
            else
                printf("%d\n", score[3]);
        }
    } while(temp != 0);
    return 0;
}