#include <iostream>
using namespace std;
int main()
{
string max_name,max_id;
string min_name,min_id;
string current_name,current_id;
int current_score;
int max_score = -1,min_score = 101;
int n;//n个学生
cin >> n;
for(int i = 0; i < n; i++)
{
cin >> current_name >> current_id >> current_score;
if(current_score > max_score)
{
max_score = current_score;
max_name = current_name;
max_id = current_id;
}
if(current_score < min_score)
{
min_score = current_score;
min_name = current_name;
min_id = current_id;
}
}
cout << max_name << ' ' << max_id <<endl;
cout << min_name << ' ' << min_id ;
return 0;
}
第一次错在 min_score设置成了0,这样的话就没办法更新min_score了。。