|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||0||0||0||0.000%|
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:
|Money Line||Wager||Result||Multiplier||Amount Won|
|Original Wager: $10.00|
|Total Returned: $173.11|
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”).
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.
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