A sort (nyoj8) (simple sort)
A sort time limit: 3000 MS | memory limit: 65535 KB difficulty: 3
-
Description
-
There are many rectangles. Each rectangle has a number, which can be repeated. We also know that the width and length of the rectangle are integers; sort by the following method (the default sorting rules are from small to large );
1. sort by number from small to large
2. For rectangles with equal numbers, they are sorted by the length of the rectangles;
3. If the numbers and lengths are the same, they are sorted by the width of the rectangle;
4. If the numbers, lengths, and widths are the same, only one rectangle is retained for sorting and redundant rectangles are deleted. Finally, all the rectangles are displayed in the order in the specified format;
-
Input
-
The first row has an integer of 0. The first row of each group has an integer of 0. In the next m row, each row has three numbers. The first number indicates the number of the rectangle,
The length of the second and third values is large, and the width of the smaller values is equal.
This is a square (the agreed length and width of the data are less than 10000 );
-
Output
-
Sequentially output the numbers and lengths of all rectangle matching the conditions of each data set.
-
Sample Input
-
181 1 11 1 11 1 21 2 11 2 22 1 12 1 22 2 1
-
Sample output
-
1 1 11 2 11 2 22 1 12 2 1
-
Source
Typical questions
# Include
# Define deusing namespace std; struct st {int xh; int c, k;} data [1010]; int cmp (st a, st B) // sorting key! {If (a. xh! = B. xh) return a. xh