#include <iostream> #include <algorithm> using namespace std; struct Student{ int id; //学号 int score; //分数 }; bool compare(Student s1, Student s2){ if(s1.score > s2.score){ return false; }else if(s1.score == s2.score && s1.id > s2.id){ return false; }else{ return true; } } int main() { int N;//学生的个数 scanf("%d", &N); Student arr[101]; for(int i = 0; i < N; i++){ scanf(("%d %d"), &arr[i].id, &arr[i].score); } sort(arr, arr + N, compare); for(int i = 0; i < N; i++){ printf("%d %d", arr[i].id, arr[i].score); printf("\n"); } }