比赛 20110928 评测结果 WWAAWAWAAW
题目名称 拱猪计分 最终得分 50
用户昵称 Launcher 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2011-09-28 21:03:31
显示代码纯文本
program heart;
var
 a:array[0..19,0..13] of integer;
 h:array[1..13,1..2]of integer;
 i,j,k,m,n,x,y,max:longint;
 t:char;
 s1,s2,s3,s4:string;
begin
 assign(input,'heart.in');reset(input);assign(output,'heart.out');rewrite(output);
 h[1,2]:=-50;h[2,2]:=-2;h[3,2]:=-3;h[4,2]:=-4;h[5,2]:=-5;h[6,2]:=-6;h[7,2]:=-7;h[8,2]:=-8;h[9,2]:=-9;h[10,2]:=-10;h[11,2]:=-20;h[12,2]:=-30;h[13,2]:=-40;
 m:=0;
 while m=0 do
 begin
  readln(s1);
  readln(s2);
  readln(s3);
  readln(s4);
  if (s1='0')and(s2='0')and(s3='0')and(s4='0') then exit;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  max:=0;
  for i:=3 to length(s1) do
   begin
    t:=s1[i];
    if t<>' ' then
      begin
        if (t='S')or(t='D')or(t='H')or(t='C') then x:=ord(t)-64;
        if (48<=ord(t))and(ord(t)<=57) then y:=y*10+(ord(t)-48);

      end;
    if (t=' ')or(i=length(s1)) then
     begin
      a[x,y]:=1;
      if x=8 then h[y,1]:=1;
      x:=0;
      y:=0;
     end;
   end;
  max:=0;
  k:=0;
  for i:=1 to 13 do
   if h[i,1]=0 then k:=1;

  if k=1 then
   begin
    for i:=1 to 13 do
     if h[i,1]=1 then max:=max+h[i,2];
    if a[19,12]=1 then max:=max-100;
    if a[4,11]=1 then max:=max+100;
    if a[3,10]=1 then max:=max*2;
   end;
  if k=0 then
    begin
      max:=max+200;
      if (a[19,12]=1)and(a[4,11]=1)and(a[3,10]<>1)then max:=500;
      if (a[19,12]=1)and(a[4,11]=1)and(a[3,10]=1)then max:=1000;
      if (a[19,12]=1)and(a[4,11]<>1) then max:=max-100;
      if (a[19,12]<>1)and(a[4,11]=1) then max:=max+100;
      if ((a[19,12]<>1)or(a[4,11]<>1))and(a[3,10]=1)then max:=max*2;
    end;

  if max>0 then write('+',max,' ') else write(max,' ');
  for i:=1 to 13 do
   h[i,1]:=0;
  for i:=3 to 19 do
   for j:=1 to 13 do
     a[i,j]:=0;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  max:=0;
  for i:=3 to length(s2) do
   begin
    t:=s2[i];
    if t<>' ' then
      begin
        if (t='S')or(t='D')or(t='H')or(t='C') then x:=ord(t)-64;
        if (48<=ord(t))and(ord(t)<=57) then y:=y*10+(ord(t)-48);

      end;
    if (t=' ')or(i=length(s2)) then
     begin
      a[x,y]:=1;
      if x=8 then h[y,1]:=1;
      x:=0;
      y:=0;
     end;
   end;
  max:=0;
  k:=0;
  for i:=1 to 13 do
   if h[i,1]=0 then k:=1;

  if k=1 then
   begin
    for i:=1 to 13 do
     if h[i,1]=1 then max:=max+h[i,2];
    if a[19,12]=1 then max:=max-100;
    if a[4,11]=1 then max:=max+100;
    if a[3,10]=1 then max:=max*2;
   end;
  if k=0 then
    begin
      max:=max+200;
      if (a[19,12]=1)and(a[4,11]=1)and(a[3,10]<>1)then max:=500;
      if (a[19,12]=1)and(a[4,11]=1)and(a[3,10]=1)then max:=1000;
      if (a[19,12]=1)and(a[4,11]<>1) then max:=max-100;
      if (a[19,12]<>1)and(a[4,11]=1) then max:=max+100;
      if ((a[19,12]<>1)or(a[4,11]<>1))and(a[3,10]=1)then max:=max*2;
    end;

  if max>0 then write('+',max,' ') else write(max,' ');
  for i:=1 to 13 do
   h[i,1]:=0;
  for i:=3 to 19 do
   for j:=1 to 13 do
     a[i,j]:=0;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  max:=0;
  for i:=3 to length(s3) do
   begin
    t:=s3[i];
    if t<>' ' then
      begin
        if (t='S')or(t='D')or(t='H')or(t='C') then x:=ord(t)-64;
        if (48<=ord(t))and(ord(t)<=57) then y:=y*10+(ord(t)-48);

      end;
    if (t=' ')or(i=length(s3)) then
     begin
      a[x,y]:=1;
      if x=8 then h[y,1]:=1;
      x:=0;
      y:=0;
     end;
   end;
  max:=0;
  k:=0;
  for i:=1 to 13 do
   if h[i,1]=0 then k:=1;

  if k=1 then
   begin
    for i:=1 to 13 do
     if h[i,1]=1 then max:=max+h[i,2];
    if a[19,12]=1 then max:=max-100;
    if a[4,11]=1 then max:=max+100;
    if a[3,10]=1 then max:=max*2;
   end;
  if k=0 then
    begin
      max:=max+200;
      if (a[19,12]=1)and(a[4,11]=1)and(a[3,10]<>1)then max:=500;
      if (a[19,12]=1)and(a[4,11]=1)and(a[3,10]=1)then max:=1000;
      if (a[19,12]=1)and(a[4,11]<>1) then max:=max-100;
      if (a[19,12]<>1)and(a[4,11]=1) then max:=max+100;
      if ((a[19,12]<>1)or(a[4,11]<>1))and(a[3,10]=1)then max:=max*2;
    end;

  if max>0 then write('+',max,' ') else write(max,' ');
  for i:=1 to 13 do
   h[i,1]:=0;
  for i:=3 to 19 do
   for j:=1 to 13 do
     a[i,j]:=0;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  max:=0;
  for i:=3 to length(s4) do
   begin
    t:=s4[i];
    if t<>' ' then
      begin
        if (t='S')or(t='D')or(t='H')or(t='C') then x:=ord(t)-64;
        if (48<=ord(t))and(ord(t)<=57) then y:=y*10+(ord(t)-48);

      end;
    if (t=' ')or(i=length(s4)) then
     begin
      a[x,y]:=1;
      if x=8 then h[y,1]:=1;
      x:=0;
      y:=0;
     end;
   end;
  max:=0;
  k:=0;
  for i:=1 to 13 do
   if h[i,1]=0 then k:=1;

  if k=1 then
   begin
    for i:=1 to 13 do
     if h[i,1]=1 then max:=max+h[i,2];
    if a[19,12]=1 then max:=max-100;
    if a[4,11]=1 then max:=max+100;
    if a[3,10]=1 then max:=max*2;
   end;
  if k=0 then
    begin
      max:=max+200;
      if (a[19,12]=1)and(a[4,11]=1)and(a[3,10]<>1)then max:=500;
      if (a[19,12]=1)and(a[4,11]=1)and(a[3,10]=1)then max:=1000;
      if (a[19,12]=1)and(a[4,11]<>1) then max:=max-100;
      if (a[19,12]<>1)and(a[4,11]=1) then max:=max+100;
      if ((a[19,12]<>1)or(a[4,11]<>1))and(a[3,10]=1)then max:=max*2;
    end;

  if max>0 then write('+',max,' ') else write(max,' ');
  for i:=1 to 13 do
   h[i,1]:=0;
  for i:=3 to 19 do
   for j:=1 to 13 do
     a[i,j]:=0;
  writeln;
 end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 close(input);close(output);
end.