#P2348. 三国杀I(洗牌&发牌)
三国杀I(洗牌&发牌)
Description
A game of Sanguosha has players, and each player needs cards. The deck has cards, which must be shuffled before dealing. Each card has the following attributes:
-
Card type:
- Basic: Sha (), Shan (), Tao (), Jiu ().
- Non-delayed tactic: Juedou (), Wanjian (), Nanman (), Wugu (), Taoyuan (), Chai (), Shun (), Tiesuo (), Wuxie (), Huogong (), Wuzhong ().
- Delayed tactic: Bing (), Le (), Shandian ().
- Mounts ().
- Weapon: Liannu (), Qinggang (), Guding (), Hanbing (), Cixiong (), Wuliu (), Qinglong (), Zhangba (), Guanshi (), Fangtian (), Yushan (), Qilin ().
- Armor: Renwang (), Bazhen (), Tengjia (), Shizi ().
-
Suit: one of .
-
Rank: one of (T stands for 10, in ascending order).
Shuffling method: After one shuffle, from top to bottom the order becomes $\left\lfloor\dfrac{k}{2}\right\rfloor+1, 1, \left\lfloor\dfrac{k}{2}\right\rfloor+2, 2, \left\lfloor\dfrac{k}{2}\right\rfloor+3, 3, \ldots, k, \left\lfloor\dfrac{k}{2}\right\rfloor$ (if there is an odd number of cards, the last extra card is simply ignored).
Dealing method: Starting from the -st card, from top to bottom give the -th card to player .
Given that the deck is shuffled times in total, determine which cards are dealt to player .
Input Format
The input has lines.
The first line contains positive integers .
Then follow lines, each with two strings. In the first string, the first character is the suit and the second character is the rank; the second string is the card type. When outputting the player’s cards, use the same format.
The meanings of are as described above.
Output Format
Output lines, each with one string, representing the cards owned by player (each line must include the card’s suit, rank, and type, in the same format as the input).
If there are not enough cards, output Error:cards not enough.
2 10 1 1
C2 K
H5 B
DT K
SA M
HQ P
D4 K
C6 P
H9 M
ST B
SK C
D4 K
C6 P
H9 M
ST B
2 7 1 1
C2 K
H5 B
DT K
SA M
HQ P
SK C
C6 P
Error:cards not enough
Hint
Constraints: For of the testdata, $1\leqslant p\leqslant n\leqslant 1000, 1\leqslant k\leqslant 100000, 1\leqslant m\leqslant 80$.
Translated by ChatGPT 5
京公网安备 11011102002149号