Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|

Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |

Language: Fool's Game
Description A card game, often called “Fool’s Game”, is quite popular in Russia. We will describe a game for two players. A standard deck of 36 cards is used. One suit is declared to be a A game consists of rounds. Before the round each player has several cards, one of the players is - it has the same suit and higher rank (ranks are ordered as usually: 6, 7, 8, 9, 10, J, Q, K, A);
- it is a trump and the card to cover is not a trump (a trump can only be covered by a higher trump).
After the cards on the table are all covered, the starting player can toss some more cards to be covered. The rank of each card tossed must be among the ranks of the cards already on the table at the moment. Now the newly added cards must be covered by the covering player, after that the starting player can toss more cards, and so on. The starting player cannot toss more cards than the covering player has at the moment. The round ends when either the covering player cannot or does not want to cover all uncovered cards on the table, or when the starting player cannot or does not want to toss more cards. In the first case, when the covering player declares that she does not want to cover all uncovered cards on the table, the starting player is given a chance to toss in more cards. The ranks of the cards tossed must be among the ranks of the cards already on the table. The number of uncovered cards on the table cannot exceed the number of cards that the covering player has at the moment. After that, the covering player loses the round and takes all the cards from the table, adding them to her cards. Starting player keeps her starting role and moves again in the next round. In the second case, when all cards on the table are covered and the starting player cannot or does not want to toss more cards, the covering player wins the round and the cards on the table are removed from the game. The players’ roles for the next round are swapped: the covering player becomes the starting one and vice versa. If, after the end of the round, one of the players has no cards, and the other one has one or more cards, then the player with no cards wins the game. If both players have no cards, then the player who was starting in the last round wins the game. Given the trump suit and the cards the players initially have, find out who wins the game if both play optimally. Both players have full information about cards in the game. Input The first line of the input file contains The second line contains All cards in players’ hands are different. Output Output “ Sample Input
Sample Output
Source |

[Submit] [Go Back] [Status] [Discuss]

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di

Any problem, Please Contact Administrator