PAT (Advanced Level) 1042. Shuffling Machine (20)
简单题。
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<algorithm>
using namespace std; struct X
{
char c;
int num;
}s[]; int ans[],p[],tmp[];
int n; void init()
{
for(int i=;i<=;i++) s[i].c='S',s[i].num=i;
for(int i=;i<=;i++) s[i].c='H',s[i].num=i-;
for(int i=;i<=;i++) s[i].c='C',s[i].num=i-;
for(int i=;i<=;i++) s[i].c='D',s[i].num=i-;
s[].c='J'; s[].num=;
s[].c='J'; s[].num=;
} int main()
{
init();
for(int i=;i<=;i++) ans[i]=i; int k; scanf("%d",&k);
for(int i=;i<=;i++) scanf("%d",&p[i]); for(int i=;i<=k;i++)
{
for(int j=;j<=;j++) tmp[p[j]]=ans[j];
for(int j=;j<=;j++) ans[j]=tmp[j];
} for(int i=;i<=;i++)
{
printf("%c%d",s[ans[i]].c,s[ans[i]].num);
if(i<) printf(" ");
else printf("\n");
}
return ;
}
PAT (Advanced Level) 1042. Shuffling Machine (20)的更多相关文章
- PTA(Advanced Level)1042.Shuffling Machine
Shuffling is a procedure used to randomize a deck of playing cards. Because standard shuffling techn ...
- 【PAT甲级】1042 Shuffling Machine (20 分)
题意: 输入洗牌次数K(<=20),输入54张牌每次洗入的位置(不是交换的位置),输出洗好的牌. AAAAAccepted code: #define HAVE_STRUCT_TIMESPEC ...
- PAT (Advanced Level) Practice 1042 Shuffling Machine (20 分) 凌宸1642
PAT (Advanced Level) Practice 1042 Shuffling Machine (20 分) 凌宸1642 题目描述: Shuffling is a procedure us ...
- PAT 1042. Shuffling Machine (20)
1042. Shuffling Machine (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Shu ...
- PAT 甲级 1042 Shuffling Machine (20 分)(简单题)
1042 Shuffling Machine (20 分) Shuffling is a procedure used to randomize a deck of playing cards. ...
- PAT 1042 Shuffling Machine (20 分)
1042 Shuffling Machine (20 分) Shuffling is a procedure used to randomize a deck of playing cards. ...
- PAT (Advanced Level) Practice 1035 Password (20 分) 凌宸1642
PAT (Advanced Level) Practice 1035 Password (20 分) 凌宸1642 题目描述: To prepare for PAT, the judge someti ...
- PAT (Advanced Level) Practice 1008 Elevator (20 分) 凌宸1642
PAT (Advanced Level) Practice 1008 Elevator (20 分) 凌宸1642 题目描述: The highest building in our city has ...
- PAT Advanced 1042 Shuffling Machine (20 分)(知识点:利用sstream进行转换int和string)
Shuffling is a procedure used to randomize a deck of playing cards. Because standard shuffling techn ...
随机推荐
- nginx 实现Web应用程序的负载均衡
文章转载自 博客园, 原文地址 http://www.cnblogs.com/ivanyb/archive/2011/11/16/2250710.html 看到园子中的大牛代震军写的一篇玩玩负载均衡- ...
- java中list集合的内容,如何使用像数据库中group by形式那样排序
java中list集合的内容,如何使用像数据库中group by形式那样排序,比如:有一个 List<JavaBean> 他中包含了一些如下的内容JavaBean:name mone ...
- Cantor数表
题目:现代数学的著名证明之一是Georg Cantor证明了有理数是可枚举的.他是用下面这一张表来证明这一命题的: 第一项是1/1,第二项是是1/2,第三项是2/1,第四项是3/1,第五项是2/2,… ...
- NSArray的containsObject漏洞
1.NSArray中的containsObject的用法 NSMutableArray *array=[NSMutableArray array]; if(![array containsObject ...
- CentOS 7 BIND 主从搭建
主机 10.2.0.15 从机 10.2.0.14 1 主机配置$vim /etc/named.bodani.com.zones zone"bodani.com" IN { typ ...
- 【Valse首发】CNN的近期进展与实用技巧(上)
作者:程程链接:https://zhuanlan.zhihu.com/p/21432547来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处. 深度学习大讲堂致力于推送人工智 ...
- fp oo
http://blog.enfranchisedmind.com/2009/05/scala-not-functional/
- 【字母全排列】 poj 1256
深搜 注意与STL模版的去重函数唯一的区别就是有去重. #include <iostream> #include <cstdio> #include <string. ...
- MFC笔记<持续更新>
1.设置垂直滚动条的位置在末尾 SCROLLINFO si; GetScrollInfo(SB_VERT, &si, SIF_PAGE | SIF_RANGE | SIF_POS); si.f ...
- js入门实例
<!DOCTYPE html> <html> <body> <h1>My First Web Page</h1> <p>My F ...