fork download
  1. program scopa;
  2. uses Math;
  3. type carta = record
  4. numero:integer;
  5. seme:char
  6. end;
  7. var
  8. line: ansistring;
  9. c:integer;
  10. i,j, h, t, tot, number, ricordaid, conta, ricordaconta: integer;
  11. suit: char;
  12. mano, table: array[1..4] of carta;
  13. settebinmano, settebintable, fattoscopa: boolean;
  14.  
  15. procedure readcard(var s: ansistring; var number: integer; var suit: char);
  16. begin
  17. if (s[1] = '1') and (s[2] = '0') then
  18. begin
  19. number := 10;
  20. suit := s[3];
  21. s := copy(s, 5, length(s));
  22. end else begin
  23. number := ord(s[1]) - ord('0');
  24. if ord(s[2])<>32 then
  25. begin
  26. suit := s[2];
  27. s := copy(s, 4, length(s));
  28. end
  29. else
  30. begin
  31. suit := s[2+1];
  32. s := copy(s, 4+1, length(s));
  33. end;
  34. end;
  35. end;
  36.  
  37.  
  38.  
  39. begin
  40. {
  41.   uncomment the following lines if you want to read/write from files
  42.   assign(input, 'input.txt'); reset(input);
  43.   assign(output, 'output.txt'); rewrite(output);
  44. }
  45. settebinmano:=false; settebintable:=false; fattoscopa:=false;
  46.  
  47. readln(line);
  48. for i:=1 to 3 do
  49. begin
  50. { card in hand }
  51. readcard(line, number, suit);
  52. writeln (line);
  53. mano[i].numero:=number;
  54. mano[i].seme:=suit;
  55. if (number=7) and (suit='G') then settebinmano:=true;
  56. { use number and suit }
  57. end;
  58.  
  59. readln(line);
  60. tot:=0;
  61. for i:=1 to 4 do
  62. begin
  63. { card on table }
  64. readcard(line, number, suit);
  65. writeln(line);
  66. table[i].numero:=number;
  67. table[i].seme:=suit;
  68. tot:=tot+number;
  69. if (number=7) and (suit='G') then settebintable:=true;
  70. { use number and suit }
  71. end;
  72.  
  73. for t:=1 to 3 do
  74. begin
  75. for i:=1 to 16 do
  76. begin
  77. tot:=0; conta:=0; ricordaconta:=0;
  78. for j:=0 to 4 do
  79. begin
  80. c:=1 Shl j;
  81. if i And c <>0 then
  82. begin
  83. tot:=tot+ table[j].numero;
  84. conta:=conta+1;
  85. end;
  86. writeln (c,' ', tot);
  87. end;
  88.  
  89. end;
  90.  
  91. end;
  92.  
  93. end.
Success #stdin #stdout 0s 5308KB
stdin
5 G 7 S 8 S
2 G 3 C 1 S 1C
stdout
7 S 8 S
8 S

3 C 1 S 1C
1 S 1C
1C

1 0
2 0
4 0
8 0
16 0
1 0
2 2
4 2
8 2
16 2
1 0
2 2
4 2
8 2
16 2
1 0
2 0
4 3
8 3
16 3
1 0
2 0
4 3
8 3
16 3
1 0
2 2
4 5
8 5
16 5
1 0
2 2
4 5
8 5
16 5
1 0
2 0
4 0
8 1
16 1
1 0
2 0
4 0
8 1
16 1
1 0
2 2
4 2
8 3
16 3
1 0
2 2
4 2
8 3
16 3
1 0
2 0
4 3
8 4
16 4
1 0
2 0
4 3
8 4
16 4
1 0
2 2
4 5
8 6
16 6
1 0
2 2
4 5
8 6
16 6
1 0
2 0
4 0
8 0
16 1
1 0
2 0
4 0
8 0
16 0
1 0
2 2
4 2
8 2
16 2
1 0
2 2
4 2
8 2
16 2
1 0
2 0
4 3
8 3
16 3
1 0
2 0
4 3
8 3
16 3
1 0
2 2
4 5
8 5
16 5
1 0
2 2
4 5
8 5
16 5
1 0
2 0
4 0
8 1
16 1
1 0
2 0
4 0
8 1
16 1
1 0
2 2
4 2
8 3
16 3
1 0
2 2
4 2
8 3
16 3
1 0
2 0
4 3
8 4
16 4
1 0
2 0
4 3
8 4
16 4
1 0
2 2
4 5
8 6
16 6
1 0
2 2
4 5
8 6
16 6
1 0
2 0
4 0
8 0
16 1
1 0
2 0
4 0
8 0
16 0
1 0
2 2
4 2
8 2
16 2
1 0
2 2
4 2
8 2
16 2
1 0
2 0
4 3
8 3
16 3
1 0
2 0
4 3
8 3
16 3
1 0
2 2
4 5
8 5
16 5
1 0
2 2
4 5
8 5
16 5
1 0
2 0
4 0
8 1
16 1
1 0
2 0
4 0
8 1
16 1
1 0
2 2
4 2
8 3
16 3
1 0
2 2
4 2
8 3
16 3
1 0
2 0
4 3
8 4
16 4
1 0
2 0
4 3
8 4
16 4
1 0
2 2
4 5
8 6
16 6
1 0
2 2
4 5
8 6
16 6
1 0
2 0
4 0
8 0
16 1