DMPG '16 B2 - Reward Reminiscence

View as PDF

Submit solution

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

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

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 \sqrt{(N - M)} \times 100 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 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 \sqrt{(5 - 2)} \times 100 \approx $173.21


  • -3
    Narcariel  commented on April 12, 2020, 5:28 p.m.


  • -6
    raytonlin1  commented on March 31, 2018, 6:32 p.m.

    This comment is hidden due to too much negative feedback. Click here to view it.