记录编号 27650 评测结果 AAAAAAAAAA
题目名称 拱猪计分 最终得分 100
用户昵称 Gravatar王者自由 是否通过 通过
代码语言 C++ 运行时间 0.003 s
提交时间 2011-09-29 07:46:46 内存使用 0.26 MiB
显示代码纯文本
#include <cstdio>
const int S[14] = {0, -50, -2, -3, -4, -5, -6, -7, -8, -9, -10, -20, -30, -40};
int score[4], n, now, t;
bool pig, sheep, times;
char c;
int main() {
    freopen("heart.in","r",stdin);
    freopen("heart.out","w",stdout);
    do {
        t = 0;
        for(int i=0; i<4; i++) {
            score[i] = 0;
            pig = sheep = times = false;
            scanf("%d", &n); t += n;
            for(int j=0; j<n; 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) times = true;
                if(c == 'H') score[i] += S[now];
            }
            scanf("\n");
            if(n == 1 && times)
                score[i] = 50;
            else if(score[i] != -194) {
                if(pig) score[i] -= 100;
                if(sheep) score[i] += 100;
                if(times) 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(times) score[i] *= 2;
            }
        }
        if(t != 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(t != 0);
    return 0;
}