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

PROGRAMMING:Simulating excel sorting

Luz5年前 (2021-05-10)题库481
Excel can sort a group of records by any specified column. Now please write a program to achieve similar functions.
###Input format:
The first line of input contains two positive integers, $$n $$($$le10 ^ 5 $$) and $$C $$, where $$n $$is the number of records and $$C $$is the column number for the specified sort. Then there are $$n $$lines, each containing a student record. Each student record is composed of student number (6 digits, no duplicate student number), name (no more than 8 digits and no spaces), score ([0, 100] integer), and adjacent attributes are separated by a space.
###Output format:
In the $$n $$line, output the result sorted according to the requirements, that is, when $$C = 1 $, sort by student number incrementally; When $$C = 2 $, it is sorted by non decreasing dictionary order of names; When $$C = 3 $, sort by non decreasing grade. When a number of students have the same name or the same grade, they will be sorted by their student number.
###Input example:
```in
3 1
000007 James 85
000010 Amy 90
000001 Zoe 60
```
###Output example:
```out
000001 Zoe 60
000007 James 85
000010 Amy 90
```






answer:If there is no answer, please comment