Poj Solution 2469

http://poj.org/problem?id=2469

#include<iostream>
using namespace std;
char *suit[]={"Clubs", "Diamonds", "Hearts", "Spades"};
char *value[]={"2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King", "Ace"};

int shuffles[101][52],n;
int card[52];

void init()
{
    int i,j;
    cin>>n;
    
    for(i=0;i<n;i++)
    for(j=0;j<52;j++)
        cin>>shuffles[i][j];

    for(i=0;i<52;i++)
        card[i]=i;
}

int main()
{
    int temp[52];
    int k,i;
    
    init();
    
    while(cin>>k)
    {
        k--;
        for(i=0;i<52;i++)
            temp[i]=card[shuffles[k][i]-1];
        
        for(i=0;i<52;i++)
            card[i]=temp[i];

        for(i=0;i<52;i++)
        {
            cout<<value[card[i]%13]<<" of "<<suit[card[i]/13]<<endl;
        }
        cout<<endl;
    }

    return 0;
}
											
This entry was posted in poj. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *