fork(2) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define REP(i,a,b) for(int i=a;i<b;i++)
  5. #define FOR(i,n) REP(i,0,n)
  6. #define REP1(i,a,b) for(int i=a;i<=b;i++)
  7. #define FOR1(i,n) REP1(i,1,n)
  8.  
  9. #define pb push_back
  10. #define mp make_pair
  11.  
  12. #define MEM(a,b) memset(a,(b),sizeof(a))
  13. #define MAX(a,b) ((a) > (b) ? (a) : (b))
  14. #define MIN(a,b) ((a) < (b) ? (a) : (b))
  15. #define F first
  16. #define S second
  17.  
  18. typedef long long LL;
  19. typedef pair<int,int> ii;
  20.  
  21. string deck[52];
  22.  
  23. int main() {
  24. int t;
  25. scanf("%d\n",&t);
  26. int count=0;
  27.  
  28. while(t--){
  29. count++;
  30.  
  31. FOR(i,52) cin>>deck[i];
  32.  
  33. int X,Y=0,num=25;
  34. // cout<<deck[25]<<endl;
  35. FOR(i,3){
  36. switch(deck[num][0]){
  37. case 'A':
  38. case 'K':
  39. case 'Q':
  40. case 'J':
  41. case 'T':
  42. Y += 10;
  43. break;
  44.  
  45. default:
  46. X = deck[num][0]-'0';
  47. Y = Y+X;
  48. num = num-(10-X);
  49. // cout<<Y<<endl;
  50. }
  51. num--;
  52. }
  53.  
  54.  
  55. FOR(i,26){
  56. num++;
  57. deck[num] = deck[26+i];
  58. }
  59. printf("Case %d: %s\n",count,deck[Y-1].c_str());
  60.  
  61. /*FOR(i,52){
  62.   printf("%s ",deck[i].c_str());
  63.   }*/
  64. }
  65. return 0;
  66. }
Success #stdin #stdout 0s 3476KB
stdin
20
5D TS 3D 5S TH AD JS 8D 7H 2D 2H QD KS QS KD JD AH 4D 5H 9S 4H 6C 7C 9D TC 9C 9H TD 4S 8C 7D JH 8H 7S KH 8S 2C 2S QH 6D 3H 3C KC 6S AS 5C 3S QC AC JC 4C 6H
JC 3C 9H KC TH 2D AC 6D 2S TC 2H 6H 8C 5D 3S JH AS JS 4C 9S 9D 6S 8H 2C 8D 8S JD 5H QD 7D KH KD AD KS 3H 5S TD 6C 7C TS 9C 7H 4S QS QC AH 3D 5C 7S 4D QH 4H
7C TD AS 8C 6H AH AC QH 9S 5H 2D JS 9D 9C 3C 5S 8D 4S 6D 4D 9H 2C 7S KH 8H QD KC JD KS 3S TS 5D 2H 4H 5C 6C 2S QS 6S TH QC KD JC JH TC 3H 3D 7D 8S 7H AD 4C
7D 8D 9C QS 2S 7H TS 4D JS QC TD 2H AS 4C TC 2C 2D QD KS KD JD 4H JC 6C AD KC KH JH 8C 9S 3S 8H AH 5H 3H 5C 6D 6H QH 5S 9D 5D AC 8S 3C 9H 7C TH 6S 3D 4S 7S
5S 6C JD AD TD 3D 4S 8H 2D 7H QD 9D 8C 4H KH AH QC 2C QH 7C 4C 4D 3C 5C 6D 7D JS 2H KD 6H JC QS AS 6S 8D KC AC 7S 8S 2S KS TS 5H 3H 9H JH 5D TC 9S 3S 9C TH
6H TH 3H 6C JD AD TC KS QC 8C 9C KH 5C 3S 9S JC 9D 2D AS 4D KD 2S TD 5H 5S AH KC QS 7H 8H 7S TS 3C 6S 7C 5D 8S QD 4C 4S 7D 3D 2H AC 6D 4H JS QH 8D JH 2C 9H
2S 7S 6D JS 5H KS AH KC 3S AS TD KH QC 4C AD JH 4S 2C QH 4D 6C JC 8D 8S 3D 9S 2H 6S TS JD 5S 9C 9H 9D 7C 5D 7H TH 8H 4H 3H 5C 6H KD 7D 3C TC 2D QS 8C QD AC
8C 2S JS 3D 7D 6S 9S 9D 5D QC 6D TC 8H 3H 6H KS AC KH 4C AS 4H 4S 5C TD QH QD KC 3C QS JH 5H 8D AD 3S 8S TH AH JD TS 9C 4D 6C KD 2C JC 7S 7C 9H 5S 2H 2D 7H
JC 6S 9H 3C KD 9C TS 8H QC 2D 7D 9D JH 8C 6C AS TC 7H 4D JS 6D 2S 3S 2C 4C KH 4S 5D 8S 8D TD 6H TH 3H KS 5H KC 5C QH AC 9S QD AH 7S JD 3D 5S 7C QS 2H 4H AD
QD 7C 4H KS 6D JC 3D 9D QH TS TD 2S 5S AH JH KD 9H 7H AC 5H 7S 2H 8H 8D 6S 5D JD AS 3S 3H 2C 7D QS 6C TC 4C JS 3C 6H TH 2D AD 9S KC 9C 8S 8C KH 4S QC 5C 4D
TH 4H TC QS 6S 5D 2D 7D AH 3H TD 5C 5S AD KD 9C 8C JC QH 4C 7C AC 3C 2C 2H 6H 8D 8H 9H 2S KC KH 7S KS 3S 3D 8S JS 5H 4D JD 6D QC 4S 9S QD TS 7H AS 6C JH 9D
KC 9C 5S TH 6D KH TS 2S 3C AC 4H 3H 6S JD QD QH 7S TD JC 9H 8D 2C TC KS 7H 2D QS 9D 8S QC 6C AD JS 7D JH 9S 3D 5D 5H 7C 8C KD 2H 8H 4S AH 6H 3S 4C AS 5C 4D
8S 8D TD 3S 4S JC KD QS 5H 7S 2S 2H 6S 6C QD 8H AS 8C 9D 9S 2D 2C 7D 5D 5C 3C TC TH JH 3D 7C 9C 7H JD JS KC 5S 6D 4H KS 3H AD 4C TS 9H AC AH QC KH 4D 6H QH
KD 8D 8C 9D 8H 5C QC 8S 6S TS 3D KC KS 5S AC JD 6C 4H JS 7H 4D 2S 4C 2D QH 3S QS 7C 5D QD JH TH TD 4S 6D 3C JC 6H 9S AS 7D 2C KH 9H 3H 5H AD 7S AH TC 9C 2H
QS 4H 4D JS 2C 3C TD 5H JD QC 8C 2D 5D 2S 6C 2H 7H 6S AC 3H 9D 4C 4S 7D 8D TH QH 5S 7C 3D 9H AS KS AD 6H 9S 8H TC KH 8S KD AH JH 3S KC QD TS 6D 7S 9C JC 5C
4S JC 3D 5D QH 9S 2D 9C TS AC 8H JD 5S 2S KD 2H TH 6D 8D 6H TC AS 3S 8S QD KH 3C 7S QC 7C QS 6S 4C 9D AH KS JS 8C 6C 2C 7D 5H 5C 3H 4H 7H JH 9H TD AD 4D KC
5D 8C AD 7C JS KS KH 2D 9C 7H 6H 7D 4D AS KC 2S JC 2C 6S AH KD 7S 9S 9H 6D 3C JD AC TC 4C 8H 4H 5C 5S QH QD 5H JH 3S TS 8D 3D QC QS TD 9D 2H 6C 3H 4S 8S TH
TC 2H AC 9D 4S 3H QH 5H 5S AD TD 7D 6H AH KS 2C 7C 8C 3D 2D 4D 3S 8S TH 9S 4H QC AS 6D 4C QS 2S 6S 6C 7S 8D TS JS KH 7H QD KC 5C JC 8H KD JH JD 3C 9H 9C 5D
4D 5H 9C 5S 5C 8C 2C 6D 8S TH 8H 7D 6H 9D TC 6S 8D 3H 2D 4C AH JD 4H 3C QD KH JH QS AC AD KC 7H KD KS 9H 3S 4S 7S JS JC 7C 6C 3D TS 5D AS 2S 2H TD QC QH 9S
2D 6C 7C QC QS 5C 3S 7D 4D 6S 4S 6D 4H 2S 8H TD 9D JD AD 2C 9S 9H TH AC KD JH QH KC TC 2H 6H 8S 3H 5H 5S JC 7H 3D 3C 7S 5D KS 4C 8D AH 9C KH QD TS JS 8C AS
stdout
Case 1: 8H
Case 2: AD
Case 3: 2H
Case 4: AH
Case 5: AS
Case 6: 3C
Case 7: 9H
Case 8: AD
Case 9: TH
Case 10: QS
Case 11: 7S
Case 12: JS
Case 13: 7H
Case 14: TD
Case 15: KS
Case 16: 4C
Case 17: 5C
Case 18: 6S
Case 19: KD
Case 20: 3H