UVA 10205 Stack 'em Up
直接模拟就好。
#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 ;
}
UVA 10205 Stack 'em Up的更多相关文章
- UVa 514 (stack的使用) Rails
练习一下stack的使用,还有要注意一下输入的格式,看了好长时间没懂. //#define LOCAL #include <iostream> #include <cstdio> ...
- uva 10205 模拟
模拟题 题目描述挺长的.... #include <cstdio> #include <cstdlib> #include <cmath> #include < ...
- UVA题目分类
题目 Volume 0. Getting Started 开始10055 - Hashmat the Brave Warrior 10071 - Back to High School Physics ...
- (Step1-500题)UVaOJ+算法竞赛入门经典+挑战编程+USACO
http://www.cnblogs.com/sxiszero/p/3618737.html 下面给出的题目共计560道,去掉重复的也有近500题,作为ACMer Training Step1,用1年 ...
- ACM训练计划step 1 [非原创]
(Step1-500题)UVaOJ+算法竞赛入门经典+挑战编程+USACO 下面给出的题目共计560道,去掉重复的也有近500题,作为ACMer Training Step1,用1年到1年半年时间完成 ...
- 算法竞赛入门经典+挑战编程+USACO
下面给出的题目共计560道,去掉重复的也有近500题,作为ACMer Training Step1,用1年到1年半年时间完成.打牢基础,厚积薄发. 一.UVaOJ http://uva.onlinej ...
- IRP IO_STACK_LOCATION 《寒江独钓》内核学习笔记(1)
在学习内核过滤驱动的过程中,遇到了大量的涉及IRP操作的代码,这里有必要对IRP的数据结构和与之相关的API函数做一下笔记. 1. 相关阅读资料 <深入解析 windows 操作系统(第4版,中 ...
- HOJ题目分类
各种杂题,水题,模拟,包括简单数论. 1001 A+B 1002 A+B+C 1009 Fat Cat 1010 The Angle 1011 Unix ls 1012 Decoding Task 1 ...
- stack UVA 442 Matrix Chain Multiplication
题目传送门 题意:给出每个矩阵的行列,计算矩阵的表达式,如果错误输出error,否则输出答案 分析:表达式求值,stack 容器的应用:矩阵的表达式求值A 矩阵是a * b,B 矩阵是b * c,则A ...
随机推荐
- 机器学习实战 -- 决策树(ID3)
机器学习实战 -- 决策树(ID3) ID3是什么我也不知道,不急,知道他是干什么的就行 ID3是最经典最基础的一种决策树算法,他会将每一个特征都设为决策节点,有时候,一个数据集中,某些特征属 ...
- 常用 Git 命令清单【转--阮一峰】
常用 Git 命令清单 感谢作者 --> 原文链接 我每天使用 Git ,但是很多命令记不住. 一般来说,日常使用只要记住下图6个命令,就可以了.但是熟练使用,恐怕要记住60-100个命令. 下 ...
- 大话卷积神经网络(CNN)
这几年深度学习快速发展,在图像识别.语音识别.物体识别等各种场景上取得了巨大的成功,例如AlphaGo击败世界围棋冠军,iPhone X内置了人脸识别解锁功能等等,很多AI产品在世界上引起了很大的 ...
- 使用泛型类简化ibatis系统架构
jdk1.5的推出为我们带来了枚举.泛型.foreach循环.同步工具包等等好东西.其中,泛型的使用为我们的代码开发提供了很大的简便,简化了我们的代码. 1.设计思路 1)GenericDao泛型类提 ...
- 质数,$\varphi$和$\mu$线性筛
typedef long long ll; bool check[N]; int mu[N],pri[N],tot; ll phi[N]; void init(int lim){ check[]=,p ...
- HDFS写数据和读数据流程
HDFS数据存储 HDFS client上传数据到HDFS时,首先,在本地缓存数据,当数据达到一个block大小时.请求NameNode分配一个block. NameNode会把block所在的Dat ...
- hadoop中namenode启动失败
jps发现namenode启动失败 每次开机都要重新格式化一下namenode才可以 其实问题出现自tmp文件上,因为每次开机就会被清空,所以现在我们配置一个tmp文件目录. 如果之前没有配置过,默认 ...
- 剑指Offer - 九度1391 - 顺时针打印矩阵
剑指Offer - 九度1391 - 顺时针打印矩阵2013-11-24 04:55 题目描述: 输入一个矩阵,按照从外向里以顺时针的顺序依次打印出每一个数字,例如,如果输入如下矩阵: 1 2 3 4 ...
- Json 转换 1 转成 true 0 转成false
- nosetests
1.nosetests 执行出测试报告 提前安装 插件nose-html系列插件 nosetests -v --with-html-output --html-out-file=报告名.html ...