#include <iostream>
#include <stdio.h>
#include <string>
#include <string.h>
using namespace std;
class student
{
public:
string m_name;
string m_stid;
int m_sore;
};
int main()
{
int i,j,max,min,maxnum,minnum;
cin >> i;
student* a = new student[i];
for (j = 0; j < i; j++)
{
cin >> a[j].m_name>> a[j].m_stid>> a[j].m_sore;
}
maxnum = minnum = 0;
min = max = a[0].m_sore;
for (j = 0; j < i; j++)
{
if (a[j].m_sore < min)
{
min = a[j].m_sore;
minnum = j;
}
if (a[j].m_sore > max)
{
max = a[j].m_sore;
maxnum = j;
}
}
cout << a[maxnum].m_name << " " << a[maxnum].m_stid << endl;
cout << a[minnum].m_name << " " << a[minnum].m_stid << endl;
return 0;
}
PAT乙级1004
最新推荐文章于 2024-07-21 22:06:29 发布