码迷,mamicode.com
首页 > 其他好文 > 详细

UVA 10205 Stack 'em Up

时间:2014-09-25 22:22:17      阅读:182      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   color   io   os   ar   for   sp   

   直接模拟就好。

#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 == 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

标签:des   style   blog   color   io   os   ar   for   sp   

原文地址:http://www.cnblogs.com/Commence/p/3993517.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!