直接模拟就好。

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <stack>
#include <queue>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define PI 3.1415926535897932626
using namespace std;
int gcd(int a, int b) {return a % b == ? b : gcd(b, a % b);}
const char* kind[] = {"Clubs","Diamonds","Hearts","Spades"};
const char* num[] = {"Jack","Queen","King","Ace"};
char tmp[];
int ord[][],N;
int cards[],ct[];
int main()
{
//freopen("sample.txt","r",stdin);
int T;
scanf("%d",&T);
while (T--)
{
scanf("%d",&N);
for (int i = ; i <= N; i++)
for (int j = ; j <= ; j++)
scanf("%d",&ord[i][j]);
for (int i = ; i <= ; i++) cards[i] = i;
getchar();
while (gets(tmp) && tmp[]!='\0')
{
int x ;
sscanf(tmp,"%d",&x);
for (int i = ; i <= ; i++) ct[i] = cards[ord[x][i]];
memcpy(cards,ct,sizeof(cards));
}
for (int i = ; i <= ; i++)
{
int t = (cards[i] - ) % ;
if (t < ) printf("%d",t + );
else printf ("%s",num[t % ]);
printf(" of ");
printf("%s\n",kind[(cards[i] - ) / ]);
}
if (T) putchar('\n');
}
return ;
}

最新文章

  1. Android 之 ProgressDialog用法介绍
  2. ABP使用及框架解析系列 - [Unit of Work part.2-框架实现]
  3. tyvj1191 迎春舞会之三人组舞
  4. 微信小程序-图片、录音、音频播放、音乐播放、视屏、文件
  5. jquery Ajax获取本地json 以及xml文件
  6. [Android Pro] Android性能优化典范第一季
  7. 修改编码格式MySQL
  8. php 随机生成
  9. Android Studio 初级安装
  10. Core Java Volume I — 4.6. Object Construction
  11. codeforce The Art of Dealing with ATM
  12. 第三章—Windows程序
  13. Tomcat死机报OutOfMemoryError: PermGen space错误
  14. css 绝对居中
  15. 【记录一次windows技术学习】使用笔记本DOS命令搭建WLAN热点
  16. 关于iconfont字体图标的使用
  17. iOS-Runtime之关于页面跳转的捷径【Runtime获取当前ViewController】
  18. oracle中nvarchar2查询结果显示总是少一位
  19. jQuery提示组件toastr(取代alert)
  20. Synchronized总结

热门文章

  1. Python os.walk() 简介
  2. Android开发——弹性滑动的两种实现方式
  3. P2680 运输计划(二分+树上差分)
  4. BZOJ 3027: [Ceoi2004]Sweet
  5. 关于update 表名 set 字段1 = 值1 and 字段2 = 值2的执行结果说明
  6. 《Cracking the Coding Interview》——第2章:链表——题目1
  7. web自动化测试,定位不到元素的原因及解决方案(持续更新中2018年9月29日)
  8. Python学习-day19 django基础篇
  9. 2、shader基本语法、变量类型、shader的三种形式、subshader、fallback、Pass LOD、tags
  10. 【转载】Unity插件研究院之自动保存场景