#include<stdio.h>
#include<string.h>
struct pnode{
char name[12], ID[12];
char gender;
int grade;
}temp,high, low;
int main(){
int i, n;
high.grade=-1; low.grade=200;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s %c %s %d", temp.name,&temp.gender,temp.ID,&temp.grade);
if(temp.gender=='F' && temp.grade>high.grade)
{high.grade=temp.grade; strcpy(high.ID,temp.ID); strcpy(high.name,temp.name);}
if(temp.gender=='M' && temp.grade<low.grade)
{low.grade=temp.grade; strcpy(low.ID,temp.ID); strcpy(low.name,temp.name);}
}
if(high.grade!=-1)printf("%s %s\n",high.name,high.ID);
else printf("Absent\n");
if(low.grade!=200)printf("%s %s\n",low.name,low.ID);
else printf("Absent\n");
if(high.grade!=-1&&low.grade!=200)printf("%d\n",high.grade-low.grade);
else printf("NA\n");
return 0;
}
PAT-A1036
最新推荐文章于 2021-10-25 22:13:21 发布