记录编号 214297 评测结果 AAAAAAAAAA
题目名称 拱猪计分 最终得分 100
用户昵称 GravatarMarvolo 是否通过 通过
代码语言 Pascal 运行时间 0.005 s
提交时间 2015-12-15 14:08:46 内存使用 0.17 MiB
显示代码纯文本
program zht;
var
pai,a,b,c,d:ansistring;

sp:array[0..4,0..20] of longint;
s,f:array[0..10] of longint;
i,bh,j:longint;

z:array[0..13] of longint;

procedure panduan;
begin

if length(pai)=2 then pai:=pai[1]+'0'+pai[2];
if (pai[1]<>'H') and (pai<>'S12') and (pai<>'D11') and (pai<>'C10') then  exit;
if pai[1]='H' then sp[bh,(ord(pai[2])-48)*10+ord(pai[3])-48]:=1;
if pai='S12' then sp[bh,14]:=1;
if pai='D11' then sp[bh,15]:=1;
if pai='C10' then sp[bh,16]:=1;
pai:='';
end;


procedure chuli;
var
k,w,g:longint;
begin
pai:='';
bh:=1;
w:=0;
k:=0;
g:=0;

w:=pos(' ',a);

for k:=1 to w-1 do
s[1]:=s[1]*10+ord(a[k])-48;

while 1<2 do
 begin
 if a='0' then break;
                                   // shou pai shu
  for k:=w+1 to length(a) do
   begin
   if a[k]=' ' then begin panduan; pai:=''; continue; end;
   pai:=pai+a[k];
   end;                                            // shou pai
 panduan; pai:='';
 break;
 end;

pai:='';
bh:=2;
w:=pos(' ',b);

for k:=1 to w-1 do
s[2]:=s[2]*10+ord(b[k])-48;

 while 1<2 do
 begin
 if b='0' then begin break; end;
   for k:=w+1 to length(b) do
   begin
   if b[k]=' ' then begin panduan; pai:=''; continue; end;
   pai:=pai+b[k];
   end;
  panduan; pai:='';
 break;
 end;
 pai:='';
 bh:=3;

  w:=pos(' ',c);

  for k:=1 to w-1 do
  s[3]:=s[3]*10+ord(c[k])-48;

 while 1<2 do
 begin
 if c='0' then break;


  for k:=w+1 to length(c) do
   begin
   if c[k]=' ' then begin panduan; pai:=''; continue; end;
   pai:=pai+c[k];
   end;
 panduan; pai:='';
 break;
 end;

 pai:='';
 bh:=4;

w:=pos(' ',d);

  for k:=1 to w-1 do
  s[4]:=s[4]*10+ord(d[k])-48;
                                  // shou pai shu
while 1<2 do
 begin
 if d='0' then break;

  for k:=w+1 to length(d) do
   begin
   if d[k]=' ' then begin panduan; pai:=''; continue; end;
   pai:=pai+d[k];
   end;
 panduan; pai:='';
 break;
 end;
k:=0;



end;

procedure tepan1(k:longint);
var
g:longint;
begin
g:=0;
for g:=1 to 4 do
if s[g]=16 then begin f[g]:=1000;bh:=1; exit; end;
end;

procedure tepan2(k:longint);
var
g,zs:longint;
begin
 zs:=0;
 for g:=1 to 13 do
  if sp[k,g]=1 then inc(zs);

 if zs=13 then begin
           if (s[k]=15) and (sp[k,16]=0) then begin f[k]:=500; exit; end;
           if (s[k]=15) and (sp[k,16]=1) then begin f[k]:=400; exit; end;
            f[k]:=200;   if sp[k,14]=1 then f[k]:=f[k]-100;
                                       end;
end;

procedure qiu(k:longint);
var
g:longint;
begin

if f[k]<>0 then exit;

for g:=1 to 13 do
if sp[k,g]=1 then f[k]:=f[k]+z[g];

if sp[k,14]=1 then f[k]:=f[k]-100;
if sp[k,15]=1 then f[k]:=f[k]+100;
if sp[k,16]=1 then if s[k]>1 then f[k]:=f[k]*2 else f[k]:=50;

end;

procedure jisuan;
var
k:longint;
begin
bh:=0;
tepan1(k);

if bh=1 then exit;

for k:=1 to 4 do
begin
tepan2(k);
qiu(k);
end;

end;

procedure print;
var
k,g:longint;
begin
if f[1]>0 then write('+',f[1],' ') else write(f[1],' ');
if f[2]>0 then write('+',f[2],' ') else write(f[2],' ');
if f[3]>0 then write('+',f[3],' ') else write(f[3],' ');
if f[4]>0 then write('+',f[4],' ') else write(f[4],' ');
writeln;

{for k:=1 to 4 do
 begin
 for g:=1 to 16 do
 write(sp[k,g],' ');
 writeln;
 end; }

fillchar(f,sizeof(f),0);
fillchar(s,sizeof(s),0);
fillchar(sp,sizeof(sp),0);
pai:='';
end;

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

z[1]:=-50; z[2]:=-2; z[3]:=-3; z[4]:=-4; z[5]:=-5; z[6]:=-6; z[7]:=-7; z[8]:=-8;
z[9]:=-9; z[10]:=-10; z[11]:=-20; z[12]:=-30; z[13]:=-40;
readln(a);
readln(b);
readln(c);
readln(d);

while a+b+c+d<>'0000' do
 begin
 bh:=0;
 chuli;
 {for i:=1 to 4 do
 begin
 for j:=1 to 16 do
 write(sp[i,j],' ');
 writeln;
 end;}
 jisuan;
 print;

 readln(a);
 readln(b);
 readln(c);
 readln(d);
 end;
close(input);
close(output);
end.