#K37267. Raffle Winning Probabilities
Raffle Winning Probabilities
Raffle Winning Probabilities
You are given a raffle contest where each participant holds a certain number of tickets. The task is to compute the winning probability for each participant. The probability for a participant is calculated using the formula:
\( p_i = \frac{t_i}{\sum_{j=1}^{n} t_j} \times 100 \)
where \( t_i \) is the ticket count for the \( i^{th} \) participant and \( n \) is the total number of participants. The result should be rounded to two decimal places. In the special case that the total number of tickets is 0, output 0.00 for every participant.
The input is read from standard input (stdin) and the output should be printed to standard output (stdout), with one line per participant in the same order as the input.
inputFormat
The input consists of three lines:
- The first line contains an integer \( n \) representing the number of participants.
- The second line contains \( n \) participant names separated by spaces.
- The third line contains \( n \) integers separated by spaces representing the ticket counts corresponding to each participant.
outputFormat
Output \( n \) lines, each line containing the participant's name followed by a colon, a space, and their winning probability rounded to two decimal places.
For example: Alice: 33.33
3
Alice Bob Charlie
10 10 10
Alice: 33.33
Bob: 33.33
Charlie: 33.33
</p>