简单题。

#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<map>
#include<queue>
#include<vector>
using namespace std; const int maxn=;
struct X
{
string name;
string sex;
string id;
int c;
}s[maxn];
int n; int main()
{
scanf("%d",&n);
for(int i=;i<=n;i++)
cin>>s[i].name>>s[i].sex>>s[i].id>>s[i].c;
int id1=-,id2=-;
int Max=-,Min=;
for(int i=;i<=n;i++)
if(s[i].sex[]=='F'&&s[i].c>Max) Max=s[i].c,id1=i; for(int i=;i<=n;i++)
if(s[i].sex[]=='M'&&s[i].c<Min) Min=s[i].c,id2=i; if(id1==-) printf("Absent\n");
else cout<<s[id1].name<<" "<<s[id1].id<<endl; if(id2==-) printf("Absent\n");
else cout<<s[id2].name<<" "<<s[id2].id<<endl; if(id1==-||id2==-) printf("NA\n");
else printf("%d\n",abs(s[id1].c-s[id2].c)); return ;
}

PAT (Advanced Level) 1036. Boys vs Girls (25)的更多相关文章

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

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

  2. PTA(Advanced Level)1036.Boys vs Girls

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

  3. 【PAT甲级】1036 Boys vs Girls (25 分)

    题意: 输入一个正整数N(题干没指出范围,默认1e5可以AC),接下来输入N行数据,每行包括一名学生的姓名,性别,学号和分数.输出三行,分别为最高分女性学生的姓名和学号,最低分男性学生的姓名和学号,前 ...

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

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

  5. PAT 1036 Boys vs Girls (25 分)

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

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

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

  7. PAT (Advanced Level) Practice 1036 Boys vs Girls (25 分)

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

  8. PAT Advanced 1036 Boys vs Girls (25 分)

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

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

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

随机推荐

  1. android开发工具eclipse的安装与配置

    l开发主要应用Eclipse 3.7版本. l辅助工具为jdk.Androidsdk Android环境搭建   –1.1.JDK安装 –1.2.Eclipse安装 –1.3.Android SDK安 ...

  2. vue 组件名和方法名 重名了,报function错误

    vue 组件名和方法名 重名了,报function错误

  3. python基础一 day9 函数升阶(1)

    函数 可读性强 复用性强def 函数名(): 函数体 return 返回值所有的函数 只定义不调用就一定不执行 先定义后调用 函数名() #不接收返回值返回值 = 函数名() #接收返回值 返回值 没 ...

  4. chrome ubuntu启动不了

    安装好后,点击图标没反应 用命令行运行chrome并显示log:google-chrome --enable-logging=stderr --log-level=4 报错如下: 解决:安装更高版本的 ...

  5. MFC中EDIT控件实现换行

    \n是C下的回撤换行.在MFC下得用\r\n.

  6. QT_4_QpushButton的简单使用_对象树

    QpushButton的简单使用 1.1 按钮的创建 QPushButton *btn = new QPushButton; 1.2 btn -> setParent(this);设置父窗口 1 ...

  7. PyTorch的十七个损失函数

    本文截取自<PyTorch 模型训练实用教程>,获取全文pdf请点击: tensor-yu/PyTorch_Tutorial​github.com 版权声明:本文为博主原创文章,转载请附上 ...

  8. [LOJ] 分块九题 4

    https://loj.ac/problem/6280 区间修改,区间求和. 本来线段树的活. //Stay foolish,stay hungry,stay young,stay simple #i ...

  9. mysql踩坑

    com.mysql.cj.core.exceptions.InvalidConnectionAttributeException: The server time zone value '****** ...

  10. c++_分巧克力(75分)

    #include <iostream> using namespace std; int n,k; ],w[]; bool fen(int bian){ ; ;i<n;i++){ c ...