UVA 10205 Stack 'em Up
2024-09-28 06:08:47
直接模拟就好。
#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 ;
}
最新文章
- Android 之 ProgressDialog用法介绍
- ABP使用及框架解析系列 - [Unit of Work part.2-框架实现]
- tyvj1191 迎春舞会之三人组舞
- 微信小程序-图片、录音、音频播放、音乐播放、视屏、文件
- jquery Ajax获取本地json 以及xml文件
- [Android Pro] Android性能优化典范第一季
- 修改编码格式MySQL
- php 随机生成
- Android Studio 初级安装
- Core Java Volume I — 4.6. Object Construction
- codeforce The Art of Dealing with ATM
- 第三章—Windows程序
- Tomcat死机报OutOfMemoryError: PermGen space错误
- css 绝对居中
- 【记录一次windows技术学习】使用笔记本DOS命令搭建WLAN热点
- 关于iconfont字体图标的使用
- iOS-Runtime之关于页面跳转的捷径【Runtime获取当前ViewController】
- oracle中nvarchar2查询结果显示总是少一位
- jQuery提示组件toastr(取代alert)
- Synchronized总结
热门文章
- Python os.walk() 简介
- Android开发——弹性滑动的两种实现方式
- P2680 运输计划(二分+树上差分)
- BZOJ 3027: [Ceoi2004]Sweet
- 关于update 表名 set 字段1 = 值1 and 字段2 = 值2的执行结果说明
- 《Cracking the Coding Interview》——第2章:链表——题目1
- web自动化测试,定位不到元素的原因及解决方案(持续更新中2018年9月29日)
- Python学习-day19 django基础篇
- 2、shader基本语法、变量类型、shader的三种形式、subshader、fallback、Pass LOD、tags
- 【转载】Unity插件研究院之自动保存场景