-->
当前位置:首页 > 题库

PROGRAMMING:Ranking of student achievement

Luz5年前 (2021-05-10)题库432
Give a list of students (name and grade), please output the result (rank and name) sorted by grade * * from big to small * *. People with the same grades have the same ranking, and they are ranked according to the lexicographical order of their names * * from small to large * *. Make sure the student's name is not repeated.
###Input format:
The first line gives an integer n no more than 10000.
Next N lines, each line gives the student's name and grade, separated by a space. The student's name should not exceed 20 characters.
###Output format:
Total output n lines, each line contains the corresponding student ranking and name, separated by spaces.
###Input example:
```in
seven
KongDezhen 94
FuTaotao 93
HuYu 94
XuJiecen 94
WuSuqi 96
ChenDa 93
HuNianbo 95
```
###Output example:
```out
1 WuSuqi
2 HuNianbo
3 HuYu
3 KongDezhen
3 XuJiecen
6 ChenDa
6 FuTaotao
```







answer:If there is no answer, please comment