Ranking X79712


Statement
 

pdf   zip

Several friends are participating in a javelin competition. Once the competition has finished, write a program that prints the ranking of the participants according to their result.

Input

The input starts with an integer NN, the number of participants. On each of the following NN lines is the name of a participant (as a single word) and the final score of this participant. If you wish, you may assume that each participant has a unique score.

Output

Print an ordered ranking of the participants on the following format:
K. X: YY.YY
Here, K is the ranking of the participant (in the range 1 to N), X is the name of the participant and YY.YY is their final score.
Hint: Use "std::setprecision" in the <<iomanip>> library to print a fixed number of decimal places:
std::cout << std::setprecision( 2 ) << std::fixed << result;

Public test cases
  • Input

    4
    John 68.99
    Emily 67.12
    Richard 59.92
    Jennie 60.01
    
    

    Output

    1. John: 68.99
    2. Emily: 67.12
    3. Jennie: 60.01
    4. Richard: 59.92
    
  • Information
    Author
    Anders Jonsson
    Language
    English
    Official solutions
    C++
    User solutions
    C++