首页 > 代码库 > UVA 10205 Stack 'em Up
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.1415926535897932626using namespace std;int gcd(int a, int b) {return a % b == 0 ? b : gcd(b, a % b);}const char* kind[] = {"Clubs","Diamonds","Hearts","Spades"};const char* num[] = {"Jack","Queen","King","Ace"};char tmp[5];int ord[110][60],N;int cards[60],ct[60];int main(){ //freopen("sample.txt","r",stdin); int T; scanf("%d",&T); while (T--) { scanf("%d",&N); for (int i = 1; i <= N; i++) for (int j = 1; j <= 52; j++) scanf("%d",&ord[i][j]); for (int i = 1; i <= 52; i++) cards[i] = i; getchar(); while (gets(tmp) && tmp[0]!=‘\0‘) { int x ; sscanf(tmp,"%d",&x); for (int i = 1; i <= 52; i++) ct[i] = cards[ord[x][i]]; memcpy(cards,ct,sizeof(cards)); } for (int i = 1; i <= 52; i++) { int t = (cards[i] - 1) % 13; if (t < 9) printf("%d",t + 2); else printf ("%s",num[t % 9]); printf(" of "); printf("%s\n",kind[(cards[i] - 1) / 13]); } if (T) putchar(‘\n‘); } return 0;}
UVA 10205 Stack 'em Up
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。