include [HTML_REMOVED]
include [HTML_REMOVED]
using namespace std;
struct s{
string name;
string id;
int fen;
char mw;
}s[1001];#结构体变量,方便变量的调用
int main()
{
int n;
cin>>n;
int min=100,max=0;#这样设置最终可以得到最大值和最小值
int t=0,f=0;#标记变量
string ID1,Name1,ID2,Name2;
for(int i=0;i[HTML_REMOVED]>s[i].name>>s[i].mw>>s[i].id>>s[i].fen;
if(s[i].mw==’M’&&s[i].fen<=min)#为什么用<=呢?因为当成绩为零时,用<会出错
{
min=s[i].fen;
ID1=s[i].id;
Name1=s[i].name;
t;
}
if(s[i].mw==’F’&&s[i].fen>=max)
{
max=s[i].fen;
ID2=s[i].id;
Name2=s[i].name;
f;
}
}
if(t==n)
{
cout<<”Absent”<<endl;
cout<<Name1<<” “<<ID1<<endl;
cout<<”NA”<<endl;
return 0;#记得return 0
}
if(f==n)
{
cout<<Name2<<” “<<ID2<<endl;
cout<<”Absent”<<endl;
cout<<”NA”<<endl;
return 0;
}
cout<<Name2<<” “<<ID2<<endl;
cout<<Name1<<” “<<ID1<<endl;
cout<<fabs(max-min)<<endl;
return 0;
}