376

# 题目

... ... ...

3
Joe Math990112 89
Mike CS991301 100
Mary EE990830 95

Mike CS991301
Joe Math990112

# 代码

## C++解法

#include <algorithm>
#include <cstdio>
const int maxn = 105;

struct Node {
char name[maxn];
char id[maxn];
int score;
void input() { scanf("%s%s%d", name, id, &score); }
void print() { printf("%s %s\n", name, id); }
bool operator<(const Node &rhs) const { return score > rhs.score; }
};
Node student[maxn];

int main() {
int n;
scanf("%d", &n);
for (int i = 0; i < n; ++i)
student[i].input();
std::sort(student, student + n);
student[0].print();
student[n-1].print();
return 0;
}

## Python解法

n = int(input())

minS = []
maxS = []

for i in range(n):
s = input().split(' ')
if not minS or int(minS[2]) > int(s[2]):
minS = s
if not maxS or int(maxS[2]) < int(s[2]):
maxS = s
# print(s,minS,maxS)

print(maxS[0],maxS[1])
print(minS[0],minS[1])

## Java解法

import java.util.ArrayList;
import java.util.Scanner;
import java.util.Collections;

class Node implements Comparable<Node> {
private String name;
private String id;
private int score;

public Node(String _name, String _id, int _score) {
this.name = _name;
this.id = _id;
this.score = _score;
}

public void print() {
System.out.printf("%s %s\n", name, id, score);
}

@Override
public int compareTo(Node rhs) {
return this.score - rhs.score;
}
}

class Main {
static Scanner in;

public static void main(String[] args) {
in = new Scanner(System.in);
int n = in.nextInt();
ArrayList<Node> students = new ArrayList<Node>();
for (int i = 0; i < n; ++i) {
String name = in.next();
String id = in.next();
int score = in.nextInt();