PAT (Advanced Level) 1036. Boys vs Girls (25)
简单题。
#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)的更多相关文章
- PAT甲级:1036 Boys vs Girls (25分)
PAT甲级:1036 Boys vs Girls (25分) 题干 This time you are asked to tell the difference between the lowest ...
- 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 ...
- 【PAT甲级】1036 Boys vs Girls (25 分)
题意: 输入一个正整数N(题干没指出范围,默认1e5可以AC),接下来输入N行数据,每行包括一名学生的姓名,性别,学号和分数.输出三行,分别为最高分女性学生的姓名和学号,最低分男性学生的姓名和学号,前 ...
- PAT 甲级 1036 Boys vs Girls (25 分)(简单题)
1036 Boys vs Girls (25 分) This time you are asked to tell the difference between the lowest grade ...
- PAT 1036 Boys vs Girls (25 分)
1036 Boys vs Girls (25 分) This time you are asked to tell the difference between the lowest grade ...
- 1036 Boys vs Girls (25分)(水)
1036 Boys vs Girls (25分) This time you are asked to tell the difference between the lowest grade o ...
- 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 ...
- 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 ...
- PAT 1036 Boys vs Girls (25分) 比大小而已
题目 This time you are asked to tell the difference between the lowest grade of all the male students ...
随机推荐
- phpstorm中快速添加函数注释
Preferences 或 command+,快捷键 Live Templates - PHP 下方 - 新建模板 ,Abbreviation 命名随便写,点击Edit Variables配置变量信息 ...
- TFS2010单独安装配置tfs build server
记录一下确实很磨人. 同样硬件和软件环境的两台服务器,其中一台服务器很久之前就配置好了tfs2010 build ,然后最近想再配置一台tfs build server,但是按照以前的配置流程始终提示 ...
- Urlrewritefilte
Urlrewritefilter是通过filter的形式,过滤所有的请求,然后再根据配置文件来转换成真正要访问的URL. 好处是隐藏真正的URL和美化提供给客户的URL. 比如,你的首页是www.** ...
- powerDesigner 一些设置
常用设置 table中需要显示的内容 --------------------------------------------------------------------------------- ...
- 解决VSCode中使用vetur插件格式化vue文件时,js代码会自动加上冒号和分号
解决VSCode中使用vetur插件格式化vue文件时,js代码会自动加上冒号和分号 在设置中把"vetur.format.defaultFormatter.js": " ...
- Hadoop伪集群部署
环境准备 [root@jiagoushi ~]# yum -y install lrzsz 已加载插件:fastestmirror Repository 'saltstack-repo': Error ...
- android打包需要的图标
ldpi:mdpi:hdpi:xhdpi:xxhdpi=3:4:6:8:12 大小: 32x32.png 48 72 96 144
- scrapy example
scrapy example scrapy with pycharm import win32api 出现ImportError: DLL load failed 错误的解决方法 pip instal ...
- node.js从入门到放弃(一)
以下内容全是我个人理解写出,如有不对,请立刻练习本人进行更改.以免被刚入门的被我带入坑里. —node是什么?我想大家应该都知道. node是前端未来干掉后端的一种语言,是用JavaScript来编写 ...
- Shell数值比较
Shell数值比较 比较 描述 n1 -eq n2 检查n1是否与n2相等 n1 -ge n2 检查n1是否大于或等于n2 n1 -gt n2 检查n1是否大于n2 n1 -le n2 检查n1是否小 ...