21642_Bang

2022-5-16 18:20| 发布者: Hocassian| 查看: 39| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-89505714444600-Problem List-采集的数据-后羿采集器.html

Pro.ID

21642

Title

Bang

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21642

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    In this problem, you are to simulate a famous wild west-theme card game. Its name is BANG The game is suitable for four to seven players gather around a table to have a good time. The game is famous partly because it's complicated. Don't worry. You are only to simulate a simplified version of the game.

    In our version of the game, only two players are involved. Let's suppose they are lames and Peipei. Each of them has four (4) hit points. A pile of cards is shuffled and placed on the table, facing down. The two players draw as many cards from the top of the pile as their hit points (i.e. lames draws the top most four cards, and then Peipei draws the next four cards). Then the game starts. The game is played in turns, alternatively. lames begins. Each player’s turn is divided into three phase:

    (1)  Draw two (2) cards from the top of the pile;

    (2)  Play any number of cards;

    (3)  Discard some cards so that the number of cards in hand does not excess his hit point.

    A card, when played, is discarded. There are some kinds of cards in the game of BANG When played, each of them has its own effect. They are listed as follow:

    Bang: You (the player who play the card) shoot at your rival. If he failed to avoid it (plays a Miss card immediately), the bullet hits him and his hit point reduce by one. You can use no more than one of this card in one of your turn.

    Grenade: Your rival must play a Miss card immediately, or he loses one hit point.

    Ghost: Your rival must discard a Bang card immediately, or he loses one hit point.

    Knife: Your rival loses one hit point immediately.

    Miss: You can not play this card in your turn. The only usage of it is to avoid being shot;

    Parry: You can not play this card in your turn. But when you have to play a "Miss", you can also play this card to avoid being hurt. Each time you play this card, draw one card from the top of the pile immediately.

    When one of the players loses all his hit point, he loses. During the game, each player will flollow such strateges:

    a) In each turn, a player will play as many cards as he can;

    b) When his rival plays a "Bang"/"Ghost"/"Brenade", his would always play the specific card if he owns one;

    c) Play a "Ghost" card prior to all other cards;

    d) Play a "Parry" card prior to a "Miss" cards;

    e) Discard "Bang" cards first (if he has to), then "Miss" cards, then "Parry" cards.

    输入

    Input contains no bore than 40 scenarios. Each of them contains multiple lines, each being one card in the pile, from top to bottom. Each scenarios is terminated by a line "===" (three equal mark). The whole input is terminated by a line contains a single period (.).

    It is guaranteed that there would be enough cards in the pile to run the game to the end.

    输出

    Description

    In this problem, you are to simulate a famous wild west-theme card game. Its name is BANG The game is suitable for four to seven players gather around a table to have a good time. The game is famous partly because it's complicated. Don't worry. You are only to simulate a simplified version of the game.

    In our version of the game, only two players are involved. Let's suppose they are lames and Peipei. Each of them has four (4) hit points. A pile of cards is shuffled and placed on the table, facing down. The two players draw as many cards from the top of the pile as their hit points (i.e. lames draws the top most four cards, and then Peipei draws the next four cards). Then the game starts. The game is played in turns, alternatively. lames begins. Each player’s turn is divided into three phase:

    (1)  Draw two (2) cards from the top of the pile;

    (2)  Play any number of cards;

    (3)  Discard some cards so that the number of cards in hand does not excess his hit point.

    A card, when played, is discarded. There are some kinds of cards in the game of BANG When played, each of them has its own effect. They are listed as follow:

    Bang: You (the player who play the card) shoot at your rival. If he failed to avoid it (plays a Miss card immediately), the bullet hits him and his hit point reduce by one. You can use no more than one of this card in one of your turn.

    Grenade: Your rival must play a Miss card immediately, or he loses one hit point.

    Ghost: Your rival must discard a Bang card immediately, or he loses one hit point.

    Knife: Your rival loses one hit point immediately.

    Miss: You can not play this card in your turn. The only usage of it is to avoid being shot;

    Parry: You can not play this card in your turn. But when you have to play a "Miss", you can also play this card to avoid being hurt. Each time you play this card, draw one card from the top of the pile immediately.

    When one of the players loses all his hit point, he loses. During the game, each player will flollow such strateges:

    a) In each turn, a player will play as many cards as he can;

    b) When his rival plays a "Bang"/"Ghost"/"Brenade", his would always play the specific card if he owns one;

    c) Play a "Ghost" card prior to all other cards;

    d) Play a "Parry" card prior to a "Miss" cards;

    e) Discard "Bang" cards first (if he has to), then "Miss" cards, then "Parry" cards.

    Input

    Input contains no bore than 40 scenarios. Each of them contains multiple lines, each being one card in the pile, from top to bottom. Each scenarios is terminated by a line "===" (three equal mark). The whole input is terminated by a line contains a single period (.).

    It is guaranteed that there would be enough cards in the pile to run the game to the end.

    Output

    For each scenario, if the player who makes the first move (i.e. Iamcs) wins or lose, output a line "WIN" or "LOSE" correspondingly.

    Sample Input

    Bang
    Bang
    Bang
    Bang
    Parry
    Bang
    Ghost
    Knife
    Bang
    Bang
    Grenade
    Miss
    Grenade
    ===
    .

    Sample Output

    LOSE

    Source

    样例输入

    Bang
    Bang
    Bang
    Bang
    Parry
    Bang
    Ghost
    Knife
    Bang
    Bang
    Grenade
    Miss
    Grenade
    ===
    .

    样例输出

    LOSE

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部