| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 128 MB | 34 | 25 | 24 | 85.714% |
Write a program that will keep score for a simple two-player game, played with a deck of cards. There are 52ドル$ cards in the deck; four of each of 13 possible names: two, three, four, five, six, seven, eight, nine, ten, jack, queen, king, ace. The cards labelled jack, queen, king, and ace are collectively known as high cards.
The deck is shuffled and placed face-down on the table. Player A turns over the top card and places it on a pile; then player B turns over the top card and places it on the pile. A and B alternate until the deck is exhausted. The game is scored as follows:
ace, with at least 4ドル$ cards remaining to be turned over, and none of the next 4ドル$ cards is a high card, that player scores 4ドル$ pointsking, with at least 3ドル$ cards remaining to be turned over, and none of the next 3ドル$ cards is a high card, that player scores 3ドル$ pointsqueen, with at least 2ドル$ cards remaining to be turned over, and none of the next 2ドル$ cards is a high card, that player scores 2ドル$ pointsjack, with at least 1ドル$ card remaining to be turned over, and the next card is not a high card, that player scores 1ドル$ pointThe input will contain 52ドル$ lines. Each line will contain the name of a card in the deck, in lowercase letters. The first line denotes the first card to be turned over; the next line the next card; and so on.
Whenever a player scores, print Player X scores n point(s). where X is the name of the player (A or B) and $n$ is the number of points scored (1, 2, 3, or 4). At the end of the game, print the total score for each player, on two lines:
Player A: n point(s). Player B: m point(s).
three seven queen eight five ten king eight jack queen six queen jack eight seven three ten four king nine six seven ace four jack ace ten nine ten queen ace king seven two five two five nine three king six eight jack six five four two ace four three two nine
Player A scores 2 point(s). Player A scores 1 point(s). Player A scores 3 point(s). Player B scores 3 point(s). Player A scores 1 point(s). Player B scores 4 point(s). Player A: 7 point(s). Player B: 7 point(s).