#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. 【BZOJ4503】两个串 FFT

    [BZOJ4503]两个串 Description 兔子们在玩两个串的游戏.给定两个字符串S和T,兔子们想知道T在S中出现了几次, 分别在哪些位置出现.注意T中可能有“?”字符,这个字符可以匹配任何字 ...

  2. JavaWeb项目(SSM)准备工作

    1.新建dynamic web project(Maven project也行) 我用的Eclipse + ssm + mysql 2.准备jar包 整合ssm的包1. springmvc: ...2 ...

  3. iOS平台iPhone和iPad免费开放源代码游戏案例列表

    此页面列表收集的是一些iPhone和iPad等iOS操作系统的开放源代码(Open Source)游戏.这些iOS开源游戏都是曾经或正发布在App Store.列表中的这些iOS开源游戏都是使用主流的 ...

  4. php 代替 js实现自定义时间选择器

    w 0-php来结合服务端数据,处理前端页面的交互: 1-php 加法 乘法的效率对比,对算术运算的优化. 减少乘法运算? function w_select($wname, $wii) { $w = ...

  5. 笔记-django学习链接

    form表单学习 https://www.cnblogs.com/weiman3389/p/6225075.html python字符串replace()方法 https://www.cnblogs. ...

  6. python函数回顾:slice()

    描述 slice() 函数实现切片对象,主要用在切片操作函数里的参数传递. 语法 class slice(stop) class slice(start, stop[, step]) 参数说明: st ...

  7. Learn How To Cross Over The Wall

    1.一个proxy的实现 http://blog.codingnow.com/2011/05/xtunnel.html 2.SOCK5 RFC http://www.faqs.org/rfcs/rfc ...

  8. UML图箭头关系

    ML定义的关系主要有:泛化.实现.依赖.关联.聚合.组合,这六种关系紧密程度依次加强,分别看一下 泛化 概念:泛化是一种一般与特殊.一般与具体之间关系的描述,具体描述建立在一般描述的基础之上,并对其进 ...

  9. Using Swift with Cocoa and Objective-C--在同个project中使用Swift和在同个project中

    http://www.cocoachina.com/newbie/basic/2014/0605/8688.html watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5u ...

  10. PHP获取客户端的IP

    function getClientIP(){    global $ip;    if (getenv("HTTP_CLIENT_IP"))        $ip = geten ...