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 ...
随机推荐
- Android学习笔记(十八) Socket
Socket在计算机网络中的概念是指套接字,包含IP地址和端口号.在Java编程中Socket是一个类,用来实现数据传输(同样可以理解为“套接字”).传输的协议包括UDP和TCP,前者为不可靠的无连接 ...
- Knockout-了解Observable与computed
KO是什么? KO不是万能的,它的出现主要是为了方便的解决下面的问题: UI元素较多,用户交互比较频繁,需要编写大量的手工代码维护UI元素的状态.样式等属性? UI元素之间关系比较紧密,比如操作一个元 ...
- ie 导出不行,不兼容问题,或只出现后缀文件无法识别
// 下载模板 @RequestMapping("/download") @ResponseBody public ResponseEntity<byte[]> dow ...
- 洛谷 P2580 于是他错误的点名开始了
题目背景 XS中学化学竞赛组教练是一个酷爱炉石的人. 他会一边搓炉石一边点名以至于有一天他连续点到了某个同学两次,然后正好被路过的校长发现了然后就是一顿欧拉欧拉欧拉(详情请见已结束比赛CON900). ...
- 在uwp仿IOS的页面切换效果
有时候我们需要编写一些迎合IOS用户使用习惯的uwp应用,我在这里整理一下仿IOS页面切换效果的代码. 先分析IOS的页面切换.用户使用左右滑动方式进行前进和后退,播放类似于FlipView的切换动画 ...
- uva1611 Crane
类似煎饼,先把1放到1,之后是子问题 (先放到前一半,再放到开头,两次操作)(任何位置,最多一次就可以放到前一半)) #include<iostream> #include<ve ...
- 阿里云人脸比对API封装
这是根据封装是根据阿里云官方给的Demo进行修改的,当时是因为编写微信小程序云函数需要使用到阿里云人脸比对接口,才对其进行封装的. 记录下来,方便下次使用. 复制下来可以直接使用. 用到的依赖如下: ...
- css3新增属性:多列(column)
css3多列能够创建多个列来对文本进行布局,就想报纸那样. 关于多列的相关属性及属性值如下: column-count: number|auto;:指定元素应分为的列数.column-fill: 指定 ...
- HTTP请求头的具体含意
为你详细解读HTTP请求头的具体含意 | 浏览:5763 | 更新:2012-03-16 16:41 当我们打开一个网页时,浏览器要向网站服务器发送一个HTTP请求头,然后网站服务器根据HTTP请求头 ...
- Manjaro安装SS客户端
首先安装shadowsocks-libev sudo pacman -S shadowsocks-libev 然后编辑配置文件 vim /etc/shadowsocks/config.json { & ...