#include <cstdio>
struct Stu{
char name[15];
char id[15];
char sex;
int score;
}tmp, min, max;
int main(){
min.score = 101;
max.score = -1;
int n;
scanf("%d", &n);
for(int i = 0; i < n; i++){
scanf("%s %c %s %d", tmp.name, &tmp.sex, tmp.id, &tmp.score);
if(tmp.sex == 'M'){
if(tmp.score < min.score){
min = tmp;
}
}
if(tmp.sex == 'F'){
if(tmp.score > max.score){
max = tmp;
}
}
}
if(min.score != 101 && max.score != -1){
printf("%s %s\n", max.name, max.id);
printf("%s %s\n", min.name, min.id);
printf("%d", max.score - min.score);
}
else if(max.score == -1 && min.score != 101){
printf("Absent\n");
printf("%s %s\n", min.name, min.id);
printf("NA");
}
else if(max.score != -1 && min.score == 101){
printf("%s %s\n", max.name, max.id);
printf("Absent\n");
printf("NA");
}
else if(max.score == -1 && min.score == 101){
printf("Absent\n");
printf("Absent\n");
printf("NA");
}
return 0;
}
PAT a1036题解
最新推荐文章于 2020-03-09 17:02:42 发布