DMPG '16 B2 - Reward Reminiscence

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 64M

Problem type

After counting his money several hundred times, Bob's stress began melting away and his passion to become an expert in gathering intelligence was rekindled. In fact, Bob's inner potential was so great he attracted the attention of the International Organization of Intelligence at the age of 13!

The IOI hosts an annual competition for post-baccalaureate students, with considerable monetary awards paid out to top-ranking contestants. If N represents the total number of contestants, and M represents the number of people possessing a strictly greater score than Bob, then Bob will take home 100 \sqrt{N-M} dollars.

Bob was so passionate about the competitions themselves that he forgot to count his winnings. Help Bob determine his winnings for each contest!

Input Specification

The first line of the input contains a single integer T denoting the number of test cases to follow (1 \le T \le 10).

Every test case consists of exactly 2 lines. The first line of each test case contains two space-separated integers:
N, the total number of contestants (2 \le N \le 25), and B, Bob's score during the competition (1 \le B \le 10^4).

The second line of each case contains N - 1 space-separated integers S_i (1 \le S_i \le 10^4), representing the score of the i^{th} contestant in no particular order (excluding Bob, the N^{th} contestant).

Output Specification

Your program should output T lines, with each line containing the string Bob wins $D at IOI!, where D is the amount Bob wins at the competition, rounded to exactly two decimal places.

Sample Input

5 2399
2400 2400 2399 2399

Sample Output

Bob wins $173.21 at IOI!


With his score of 2399, Bob manages to secure his spot behind only 2 people. As a result, he is awarded 100 \sqrt{5-2} \approx $173.21.


There are no comments at the moment.