记录编号 79902 评测结果 AAAAAAAAAA
题目名称 拱猪计分 最终得分 100
用户昵称 Gravatar, 是否通过 通过
代码语言 Pascal 运行时间 0.003 s
提交时间 2013-11-06 16:14:38 内存使用 0.17 MiB
显示代码纯文本
program gmy(input,output);
var
 c:char;
 a:array[1..4]of string;
 d:array[1..4]of longint;
 b:array[1..4,1..16]of longint;
 i,k,l:longint;
begin
 assign(input,'heart.in');
 reset(input);
 assign(output,'heart.out');
 rewrite(output);
 repeat
   readln(a[1]);
   readln(a[2]);
   readln(a[3]);
   readln(a[4]);
   fillchar(b,sizeof(b),0);
   if (a[1]='0') and (a[2]='0') and (a[3]='0') and (a[4]='0') then break;
   for i:=1 to 4 do
     if a[i]<>'0' then begin
                        if a[i,2]=' ' then k:=3
                                      else k:=4;
                        repeat
                          l:=0;
                          for c:='0' to '3' do
                            if a[i,k]+a[i,k+1]+a[i,k+2]='H1'+c then begin
                                                                     b[i,integer(c)-38]:=1;
                                                                     k:=k+4;
                                                                     l:=1;
                                                                     break;
                                                                    end;
                          if l=1 then continue;
                          for c:='1' to '9' do
                            if a[i,k]+a[i,k+1]='H'+c then begin
                                                           b[i,integer(c)-48]:=1;
                                                           k:=k+3;
                                                           l:=1;
                                                           break;
                                                          end;
                          if l=1 then continue;
                          if a[i,k]+a[i,k+1]+a[i,k+2]='S12' then begin
                                                                  b[i,14]:=1;
                                                                  k:=k+4;
                                                                  continue;
                                                                 end;
                          if a[i,k]+a[i,k+1]+a[i,k+2]='D11' then begin
                                                                  b[i,15]:=1;
                                                                  k:=k+4;
                                                                  continue;
                                                                 end;
                          if a[i,k]+a[i,k+1]+a[i,k+2]='C10' then begin
                                                                  b[i,16]:=1;
                                                                  k:=k+4;
                                                                  continue;
                                                                 end;
                        until k>length(a[i]);
                       end;
   fillchar(d,sizeof(d),0);
   for i:=1 to 4 do
     begin
      if (b[i,1]=1) and (b[i,2]=1) and (b[i,3]=1) and (b[i,4]=1)
      and (b[i,5]=1) and (b[i,6]=1) and (b[i,7]=1) and (b[i,8]=1)
      and (b[i,9]=1) and (b[i,10]=1) and (b[i,11]=1) and (b[i,12]=1)
      and (b[i,13]=1) then begin
                            d[i]:=d[i]+200;
                            if (b[i,14]=1) and (b[i,15]=1) then d[i]:=d[i]+300
                                                           else begin
                                                                 if b[i,14]=1 then d[i]:=d[i]-100;
                                                                 if b[i,15]=1 then d[i]:=d[i]+100;
                                                                end;
                            if b[i,16]=1 then d[i]:=d[i]*2;
                           end
                      else begin
                            if b[i,1]=1 then d[i]:=d[i]-50;
                            if b[i,2]=1 then d[i]:=d[i]-2;
                            if b[i,3]=1 then d[i]:=d[i]-3;
                            if b[i,4]=1 then d[i]:=d[i]-4;
                            if b[i,5]=1 then d[i]:=d[i]-5;
                            if b[i,6]=1 then d[i]:=d[i]-6;
                            if b[i,7]=1 then d[i]:=d[i]-7;
                            if b[i,8]=1 then d[i]:=d[i]-8;
                            if b[i,9]=1 then d[i]:=d[i]-9;
                            if b[i,10]=1 then d[i]:=d[i]-10;
                            if b[i,11]=1 then d[i]:=d[i]-20;
                            if b[i,12]=1 then d[i]:=d[i]-30;
                            if b[i,13]=1 then d[i]:=d[i]-40;
                            if b[i,14]=1 then d[i]:=d[i]-100;
                            if b[i,15]=1 then d[i]:=d[i]+100;
                            if (b[i,1]=0) and (b[i,2]=0) and (b[i,3]=0) and (b[i,4]=0)
                            and (b[i,5]=0) and (b[i,6]=0) and (b[i,7]=0) and (b[i,8]=0)
                            and (b[i,9]=0) and (b[i,10]=0) and (b[i,11]=0) and (b[i,12]=0)
                            and (b[i,13]=0) and (b[i,14]=0) and (b[i,15]=0) then
                            begin
                             if b[i,16]=1 then d[i]:=d[i]+50;
                            end
                            else if b[i,16]=1 then d[i]:=d[i]*2;
                           end;
     end;
   for i:=1 to 4 do
     if d[i]>0 then write('+',d[i],' ')
               else write(d[i],' ');
   writeln;
 until false;
 close(input);
 close(output);
end.