1999 LSU Computer Science High School Programming Contest
Veteran Problem 6
It's your deal!

You are to read in a deck of shuffled cards and then deal out a solitare hand. The input will be the numbers from 1 to 52 in shuffled order (all 52 may not be present, but enough to deal the hand will be present). You are to then output what seven cards would be face up after the Solitare hand is dealt.

Your input will consist of one number per line. The cards in the deck will be terminated by a zero (0). You may have multiple "decks" in a data file. The input file will end with a negative one (-1) as the first card of a new "deck".

Example Input File: (Note: the data file has been arranged into two columns to save space/paper. Process column one first (top to bottom), and then column two. In parentheses beside each number is its value - this will not be in the real file - it is here to clarify numbering).

16 (3 of diamonds)         35 (9 of clubs)
3  (3 of hearts)           0  (end of first deal)
52 (king of spades)        2  (2 of hearts)
27 (ace of clubs)          7  (7 of hearts)
17 (4 of diamonds)         13 (king of hearts)
22 (9 of diamonds)         48 (9 of spades)
50 (jack of spades)        17 (4 of diamonds)
44 (5 of spades)           11 (jack of hearts)
38 (queen of clubs)        20 (7 of diamonds)
8  (8 of hearts)           1  (ace of hearts)
11 (jack of hearts)        5  (5 of hearts)
34 (8 of clubs)            14 (ace of diamonds)
5  (5 of hearts)           46 (7 of spades)
32 (6 of clubs)            16 (3 of diamonds)
30 (4 of clubs)            45 (6 of spades)
39 (king of clubs)         10 (10 of hearts)
36 (10 of clubs)           26 (king of diamonds)
45 (6 of clubs)            24 (jack of diamonds)
46 (7 of spades)           40 (ace of spades)
48 (9 of spades)           44 (5 of spades)
13 (king of hearts)        28 (2 of clubs)
43 (4 of spades)           15 (2 of diamonds)
41 (2 of spades)           37 (jack of clubs)
10 (10 of hearts)          19 (6 of diamonds)
51 (queen of spades)       16 (3 of clubs)
6  (6 of hearts)           49 (10 of spades)
14 (ace of diamonds)       18 (5 of diamonds)
4  (4 of hearts)           41 (2 of spades)
49 (10 of spades)          34 (8 of clubs)
26 (king of diamonds)      35 (9 of clubs)
7  (7 of hearts)           17 (4 of clubs)
42 (3 of spades)           0  (end of second deal)
12 (queen of hearts)       -1 (end of data)

The ouput for this example would be:

Game 1: 3 of diamonds, 5 of spades, 6 of clubs, 7 of spades, 2 of spades, 6 of hearts, 4 of hearts
Game 2: 2 of hearts, ace of hearts, 10 of hearts, 2 of clubs, 3 of clubs, 2 of spades, 9 of clubs

NOTE: Spacing around numbers is not critcal in this problem.

EXPLAINATION:

In solitaire you deal seven stacks of cards.  Numbering the stacks 
from left to right you have the following:

  stack      stack     stack    stack     stack    stack     stack
    1          2         3        4         5        6         7

Each stack has in it the same number of cards as its stack number (stack 
3 has 3 cards in it).

Dealing the stacks from left to right, the leftmost stack without its 
required number of cards gets a face up card and all other stacks get 
a face down card.  This continues until stack 7 has a seventh (face 
up) card.



Return to the Top of Page, First Page, Novice Problem Set, or Veteran Problem Set.


Clarifications:







Return to the Top of Page, First Page, or Veteran Problem Set.



The statements and opinions included in these pages are those of the LSU High School Programming Contest Staff only. Any statements and opinions included in these pages are not those of Louisiana State University or the LSU Board of Supervisors.
© 1999 LSU High School Programming Contest

Return to the LSU High School Programming Contest Homepage