#include <iostream>
#include<stdio.h>
using namespace std;
struct Student{
char name[15];
char gender;
char id[15];
int grade;
};
int main()
{
int n;
int absent[2]={0};
scanf("%d",&n);
Student boy={"boy",'M',"001",100},girl={"girl",'F',"002",0},temp;
for(int i=0;i<n;i++){
scanf("%s %c %s %d",temp.name,&temp.gender,temp.id,&temp.grade);
if(temp.gender=='M'){
absent[0]=1;
if(temp.grade<boy.grade) boy=temp;
}
if(temp.gender=='F'){
absent[1]=1;
if(temp.grade>girl.grade) girl=temp;
}
}
if(absent[1]==0) printf("Absent\n");
else printf("%s %s\n",girl.name,girl.id);
if(absent[0]==0) printf("Absent\n");
else printf("%s %s\n",boy.name,boy.id);
if(absent[0]==0||absent[1]==0) printf("NA\n");
else printf("%d\n",girl.grade-boy.grade);
return 0;
}
PAT A 1036 Boys vs Girls
最新推荐文章于 2020-03-12 16:17:09 发布