#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
struct Student{
string name;
string gender;
string id;
int grade;
int idd;
};
int n;
bool cmp(Student a,Student b){
return a.grade<b.grade;
}
vector<Student> studentSet;
int main(){
cin>>n;
for(int i=0;i<n;i++){
Student s;
cin>>s.name>>s.gender;
cin>>s.id>>s.grade;
s.idd=i;
studentSet.push_back(s);
}
sort(studentSet.begin(),studentSet.end(),cmp);
int p=-1,q=-1;
for(int i=0;i<n;i++){
if(studentSet[i].gender[0]=='M'){
if(p==-1){p=i;}
}
if(studentSet[i].gender[0]=='F'){
q=i;
}
}
int flag=-1;
if(q==-1){
cout<<"Absent"<<endl;
flag=1;
}else{
cout<<studentSet[q].name<<" "<<studentSet[q].id<<endl;
}
if(p==-1){
cout<<"Absent"<<endl;
flag=1;
}else{
cout<<studentSet[p].name<<" "<<studentSet[p].id<<endl;
}
if(flag==-1){
cout<<(studentSet[q].grade-studentSet[p].grade)<<endl;
}else{
cout<<"NA"<<endl;
}
return 0;
}

PAT1036. Boys vs Girls (25)的更多相关文章

  1. PAT1036:Boys vs Girls

    1036. Boys vs Girls (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue This ti ...

  2. PAT 甲级 1036 Boys vs Girls (25 分)(简单题)

    1036 Boys vs Girls (25 分)   This time you are asked to tell the difference between the lowest grade ...

  3. PAT 1036 Boys vs Girls (25 分)

    1036 Boys vs Girls (25 分)   This time you are asked to tell the difference between the lowest grade ...

  4. 1036 Boys vs Girls (25分)(水)

    1036 Boys vs Girls (25分)   This time you are asked to tell the difference between the lowest grade o ...

  5. PAT甲级:1036 Boys vs Girls (25分)

    PAT甲级:1036 Boys vs Girls (25分) 题干 This time you are asked to tell the difference between the lowest ...

  6. PAT 1036 Boys vs Girls (25分) 比大小而已

    题目 This time you are asked to tell the difference between the lowest grade of all the male students ...

  7. 1036. Boys vs Girls (25)

    #include <stdio.h>#include <string.h>int main(){ int n,i; while(scanf("%d",&am ...

  8. PAT甲题题解-1036. Boys vs Girls (25)-找最大最小,大水题

    题意:给出n个人的姓名.性别.ID.分数,让你找出其中哪个妹纸分数最高.哪个汉子分数最低.以及他们的差如果没有妹纸或者汉子,则对应输出Absent,差用NA代替. 就是for一遍找最大最小值,水题 # ...

  9. 1036 Boys vs Girls (25)(25 point(s))

    problem This time you are asked to tell the difference between the lowest grade of all the male stud ...

随机推荐

  1. poj1325(Machine Schedule)

    题目链接:传送门 题目大意:有k个任务,可以在 A 机器的 x 位上完成,也可以在 B 机器的 y 位上完成.问最少需要多少个点位即可完成所有任务. 题目思路:求最小点覆盖. 把 A 机器,B 机器看 ...

  2. DB2 SQL方式查看版本

    SELECT service_level, fixpack_num FROM TABLE   (sysproc.env_get_inst_info())   as INSTANCEINFO

  3. FW qunit introduction

    自动化测试软件对于开发来说是一个很重要的工具,而单元测试对于自动化测试来说是基本组成部分:软件的每一个组件或者单元可以在非人工介入的情况下,使用测试工具一遍遍的重复执行.换句话说,就是你可以写一次测试 ...

  4. scrapy spider

    spider 定义:在spiders文件夹中由用户自定义,继承scrapy.Spider类或其子类 Spider并没有提供什么特殊的功能. 其仅仅请求给定的 start_urls/start_requ ...

  5. python常用方法详解

    1,讲序列分解为单独的变量 p=(4,5) x,y=p print(x,y) 如果在分解中想丢弃某些特定的值,可以采用_来进行 data=['A','B','c','d'] _,name,age,_= ...

  6. 48dp rhythm

  7. 使用Xcode改动iOS项目project名和路径名

    对,好.错.改正. ------ 前言 系统 10.9 开发平台 xcode 5.0 旧project名 MyProject-iPad 改动之后 新project名 FjSk-iPad 点击项目,进入 ...

  8. JSP页面退出时清除会话Session

    我们用一个quit.jsp来处理用户退出系统的操作,quit.jsp负责注销session,及时释放资源. 注销session. 关闭浏览器窗口. 其代码如下所示: <%@ page conte ...

  9. Oracle Shared Pool 原理

    Oracle Shared Pool 原理 由于shared pool中最重要的是library cache,所以本文主要讲解Library cache的结构,library cache latch, ...

  10. Hadoop十年解读与发展预测

    编者按:Hadoop于2006年1月28日诞生,至今已有10年,它改变了企业对数据的存储.处理和分析的过程,加速了大数据的发展,形成了自己的极其火爆的技术生态圈,并受到非常广泛的应用.在2016年Ha ...