比赛 20110928 评测结果 WAAAAAAAAW
题目名称 拱猪计分 最终得分 80
用户昵称 苏轼 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2011-09-28 21:30:35
显示代码纯文本
program heart (input, output);

var
    n, i, j:integer;
    ans: array [1..4] of integer;

function ohayou: integer;
    const
        score: array [1..13] of integer =
            (-50, -2, -3, -4, -5, -6, -7, -8, -9, -10, -20, -30, -40);
    var
        n, i, p, hx, sc: integer;
        ch: char;
        h: array [1..13] of boolean;
        d11, s12, c10: boolean;
    begin
        hx := 0;
        sc := 0;
        fillchar(h, sizeof(h), 0);
        d11 := false;
        s12 := false;
        c10 := false;

        read(n);
        for i:= 1 to n do
        begin
            read(ch);
            read(ch);
            read(p);
            if ch='H' then
            begin
                inc(hx);
                inc(sc, score[p]);
                h[p] := true;
            end
            else if (ch='S') and (p=12) then
                s12 := true
            else if (ch='D') and (p=11) then
                d11 := true
            else if (ch='C') and (p=10) then
                c10 := true;
        end;

        if c10 and not(s12) and not(d11) and (hx=0) then
            exit(50)
        else if hx <> 13 then
        begin
            if s12 then
                inc(sc, -100);
            if d11 then
                inc(sc, 100);
        end
        else
        begin
            sc := 200;
            if s12 and d11 then
                inc(sc, 500);
        end;

        if c10 then
            exit(sc*2)
        else
            exit(sc);
    end;

begin
    assign(input, 'heart.in');
    reset(input);
    assign(output, 'heart.out');
    rewrite(output);

    while true do
    begin
        for j:= 1 to 4 do
            ans[j] := ohayou();
        if (ans[1]=0) and (ans[2]=0) and (ans[3]=0) and (ans[4]=0) then
            break;
        for j:= 1 to 4 do
        begin
            if ans[j] > 0 then
                write('+');
            write(ans[j], ' ');
        end;
        writeln;
    end;

    close(input);
    close(output);
end.