21071_ParlayWagering

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

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

Pro.ID

21071

Title

Parlay Wagering

Title链接

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

AC

14

Submit

966

Ratio

1.45%

时间&空间限制

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

    Parlay wagering offers sports bettors the opportunity to win a large sum of money from a small initial wager. A parlay wager is a combination of individual independent wagers that only pays if no individual wager loses. The payout from each wager is applied or “parlayed” to the next wager in turn. If any individual wager loses, the bettor receives nothing. If any individual wager is a tie or “push”, that wager is effectively ignored, reducing the ultimate payout.
    The sports book quotes the payout rate for an individual wager as a “money line”, a non-zero integer in the range -2000 to 2000. To compute the payout for a successful wager, the money line is converted to a decimal multiplier as follows: if the money line is positive, it is divided by 100 to obtain the multiplier. If the money line is negative, the absolute value is divided into 100 to obtain the multiplier. The multiplier is always truncated to three digits after the decimal point. The wager is multiplied by this multiplier to determine the amount won. The amount won is truncated to the cent (the sports book keeps the fractional cents).

    Consider the following example for a five-way parlay wager:


    The maximum payout for any parlay wager is $1 million. If the calculated total exceeds that amount, the actual total returned will be $1 million.

    Write a program that will calculate the total amount returned for a series of parlay wagers.

    For each parlay wager, your program is to print the total amount returned in dollars and cents on a single line starting in the first column without embedded or trailing whitespace. Print the leading dollar sign and insert commas at the millions and thousands positions as needed.

    输入

    Input will consist of several wagers. The first line of input to your program will contain the total number of parlay wagers as a single positive integer.
    Each wager that follows will be represented by a series of lines.
    The first line of each parlay wager contains the initial bet and the count of individual wagers as integers separated from each other by a single space.
    The following lines represent the individual wagers, one per line. Each individual wager is given as its money line followed by a single space and the result of the wager (“Win”, “Tie”, or “Loss”).

    输出

    Description
    Parlay wagering offers sports bettors the opportunity to win a large sum of money from a small initial wager. A parlay wager is a combination of individual independent wagers that only pays if no individual wager loses. The payout from each wager is applied or “parlayed” to the next wager in turn. If any individual wager loses, the bettor receives nothing. If any individual wager is a tie or “push”, that wager is effectively ignored, reducing the ultimate payout.
    The sports book quotes the payout rate for an individual wager as a “money line”, a non-zero integer in the range -2000 to 2000. To compute the payout for a successful wager, the money line is converted to a decimal multiplier as follows: if the money line is positive, it is divided by 100 to obtain the multiplier. If the money line is negative, the absolute value is divided into 100 to obtain the multiplier. The multiplier is always truncated to three digits after the decimal point. The wager is multiplied by this multiplier to determine the amount won. The amount won is truncated to the cent (the sports book keeps the fractional cents).

    Consider the following example for a five-way parlay wager:


    The maximum payout for any parlay wager is $1 million. If the calculated total exceeds that amount, the actual total returned will be $1 million.

    Write a program that will calculate the total amount returned for a series of parlay wagers.

    For each parlay wager, your program is to print the total amount returned in dollars and cents on a single line starting in the first column without embedded or trailing whitespace. Print the leading dollar sign and insert commas at the millions and thousands positions as needed.

    Input
    Input will consist of several wagers. The first line of input to your program will contain the total number of parlay wagers as a single positive integer.
    Each wager that follows will be represented by a series of lines.
    The first line of each parlay wager contains the initial bet and the count of individual wagers as integers separated from each other by a single space.
    The following lines represent the individual wagers, one per line. Each individual wager is given as its money line followed by a single space and the result of the wager (“Win”, “Tie”, or “Loss”).
    Output
    For each parlay wager, your program should print one line containing the total amount returned in dollars and cents. Print the leading dollar sign and insert commas at the millions and thousands positions as needed.
    Sample Input
    3
    10 5
    -170 Win
    -160 Win
    125 Win
    -135 Win
    -140 Win
    15 8
    100 Win
    -100 Tie
    -250 Win
    135 Tie
    265 Tie
    1500 Win
    120 Win
    130 Win
    10 2
    100 Loss
    300 Tie
    Sample Output
    $173.11
    $3,400.32
    $0.00
    Source

    样例输入

    3
    10 5
    -170 Win
    -160 Win
    125 Win
    -135 Win
    -140 Win
    15 8
    100 Win
    -100 Tie
    -250 Win
    135 Tie
    265 Tie
    1500 Win
    120 Win
    130 Win
    10 2
    100 Loss
    300 Tie

    样例输出

    $173.11
    $3,400.32
    $0.00

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部