比赛 20110928 评测结果 WAAAAAAAAW
题目名称 拱猪计分 最终得分 80
用户昵称 苏轼 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2011-09-28 21:30:35
显示代码纯文本
  1. program heart (input, output);
  2.  
  3. var
  4. n, i, j:integer;
  5. ans: array [1..4] of integer;
  6.  
  7. function ohayou: integer;
  8. const
  9. score: array [1..13] of integer =
  10. (-50, -2, -3, -4, -5, -6, -7, -8, -9, -10, -20, -30, -40);
  11. var
  12. n, i, p, hx, sc: integer;
  13. ch: char;
  14. h: array [1..13] of boolean;
  15. d11, s12, c10: boolean;
  16. begin
  17. hx := 0;
  18. sc := 0;
  19. fillchar(h, sizeof(h), 0);
  20. d11 := false;
  21. s12 := false;
  22. c10 := false;
  23.  
  24. read(n);
  25. for i:= 1 to n do
  26. begin
  27. read(ch);
  28. read(ch);
  29. read(p);
  30. if ch='H' then
  31. begin
  32. inc(hx);
  33. inc(sc, score[p]);
  34. h[p] := true;
  35. end
  36. else if (ch='S') and (p=12) then
  37. s12 := true
  38. else if (ch='D') and (p=11) then
  39. d11 := true
  40. else if (ch='C') and (p=10) then
  41. c10 := true;
  42. end;
  43.  
  44. if c10 and not(s12) and not(d11) and (hx=0) then
  45. exit(50)
  46. else if hx <> 13 then
  47. begin
  48. if s12 then
  49. inc(sc, -100);
  50. if d11 then
  51. inc(sc, 100);
  52. end
  53. else
  54. begin
  55. sc := 200;
  56. if s12 and d11 then
  57. inc(sc, 500);
  58. end;
  59.  
  60. if c10 then
  61. exit(sc*2)
  62. else
  63. exit(sc);
  64. end;
  65.  
  66. begin
  67. assign(input, 'heart.in');
  68. reset(input);
  69. assign(output, 'heart.out');
  70. rewrite(output);
  71.  
  72. while true do
  73. begin
  74. for j:= 1 to 4 do
  75. ans[j] := ohayou();
  76. if (ans[1]=0) and (ans[2]=0) and (ans[3]=0) and (ans[4]=0) then
  77. break;
  78. for j:= 1 to 4 do
  79. begin
  80. if ans[j] > 0 then
  81. write('+');
  82. write(ans[j], ' ');
  83. end;
  84. writeln;
  85. end;
  86.  
  87. close(input);
  88. close(output);
  89. end.