ZOJ Problem Set - 1641
To analyse the notes of Bridge is a good method to improve our level. Here are some notes of it, you are supposed to output the result of each game.
The note of Bridge has two parts, one is the "Promise" of the game, the other is a sequence of 52 cards, which represented the sequence of the 52 cards handed out by the players. The format of data is as follows:
[n][suit] ------ Promise of the game
In the Promise:
"3C" is the Promise of the game, which means in this game the Banker must win 9 turns in all (3 + 6 == 9), "C"(Club) is the King suit. The next 13 line, 4 cards in each line represent the cards in each turn, according the order. Of course, the player who handed out the most powerful card in the last turn has to hand out first in this turn. The next player of the Banker hands out first in the first turn.
In each turn, the King suit is always more powerful than other suit of cards. The suit of the first card is always greater than other suit (except the King suit). If the suit is the same, then accord the sequence: A > K > Q > J > T > 9 > 8 > 7 > 6 > 5 > 4 > 3 > 2.
In each turn, the player who handed out the most powerful card wins this turn.
In the first turn in the example, the rivalries handed out C6 and SK, but the Banker handed out H9 and HJ. "C" is the King suit of the game, so the Banker didn't win in this turn. Then the rivalries also hand out first: S7 and SA, but one of the Banker hands out a CK, so the Banker win this turn, and hand out first in the third turn.
The Banker's purpose is that win at least (n + 6) turn, where n is the number in the Promise.
Proceed to the end of file.
Author: JIANG, Hao
Source: ZOJ Monthly, September 2003