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 ...
随机推荐
- python——获取数据类型
在python中,可使用type()和isinstance()内置函数获取数据类型 如: (1)type()的使用方法: >>> a = '230' >> ...
- Java设置模式
单例模式 装饰者模式 代理模式
- js过滤和包含数组方法
let data=[{'Linda':'apple'},{'Linda':'pear'},{'Linda':'apricot'},{'Linda':'peach'},{'Linda':'grape'} ...
- python基础之数据类型与变量patr1
1:编写for循环,利用索引遍历出每一个字符 msg='hello egon 666' 2:编写while循环,利用索引遍历出每一个字符 msg='hello egon 666' 3:msg='hel ...
- Linux 安装github并配置ssh
首先,你得有个github帐号. 1.用apt-get install git的方式安装git test@er:/$ sudo add-apt-repository ppa:git-core/ppa ...
- django中间件CsrfViewMiddleware源码分析,探究csrf实现
Django Documentation csrf保护基于以下: 1. 一个CSRF cookie 基于一个随机生成的值,其他网站无法得到.此cookie由CsrfViewMiddleware产生.它 ...
- 网易OpenStack部署运维实战
OpenStack自2010年项目成立以来,已经有超过200个公司加入了 OpenStack 项目,目前参与 OpenStack 项目的开发人员有 17,000+,而且这些数字还在增加,作为一个开源的 ...
- Python 3基础教程1-环境安装和运行环境
本系列开始介绍Python3的基础教程,为什么要选中Python 3呢?之前呢,学Python 2,看过笨方法学Python,学了不到一个礼拜,就开始用Python写Selenium脚本.最近看到一些 ...
- time模块与random模块,六位含字母随机验证码
# time模块# import time# time.time()#计算这一时刻时间戳 *******# time.sleep(1)#让cpu休眠一定时间 *******# time.clock() ...
- day06_02 元组
1.0 元组 元组被称为只读列表,即数据可以被查询,但不能被修改,所以,列表的切片操作同样适用于元组.元素卸载小括号(())里,元素之间用逗号隔开. tup1 = () #空元组 tup2 = (20 ...