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 ...
随机推荐
- 版本号比较versioncompare方法,java实现
测试
- 2015Java参赛邀请函
[导读]甲骨文公司值Java语言发布20周年之际,携手全国高等级学校计算机教育研究会.教育部高等学校计算机类专业教学指导委员会,共同举办了2015年“甲骨文杯”全国Java程序设计大赛,为二百万名中国 ...
- vue render {} 对象 说明文档
Vue学习笔记进阶篇——Render函数 http://www.mamicode.com/info-detail-1906336.html 深入data object参数 有一件事要注意:正如在模板语 ...
- CAD交互绘制带周长面积的矩形框(网页版)
主要用到函数说明: _DMxDrawX::DrawLine 绘制一个直线.详细说明如下: 参数 说明 DOUBLE dX1 直线的开始点x坐标 DOUBLE dY1 直线的开始点y坐标 DOUBLE ...
- Gear Pump: Why Install A Pressure Reducing Valve?
When the Gear Pump Manufacturers prompts to install a gear pump, the following points should ...
- MySQL-07 日志管理
学习目标 MySQL日志 二进制日志 错误日志 查询通用日志 慢查询日志 MySQL日志 MySQL日志分为四类,说明如下: 错误日志:记录MySQL服务的启动.运行或者停止时出现的问题. 查询日志: ...
- [LUOGU] P3004 [USACO10DEC]宝箱Treasure Chest
第一眼:区间DP,可以瞎搞 f[i][j]=max(sum(i,j)-f[i+1][j],sum(i,j)-f[i][j-1]) 提出来就是f[i][j]=sum(i,j)-min(f[i+1][j] ...
- Firefox--摄像头麦克风权限
在自动化测试的过程中,可能会遇到来自浏览器的权限提示(摄像头.麦克风),今天,就讨论一下如何结局这个问题. 先来认识一下来自Firefox的权限提示,访问一个需要摄像头或者麦克风的网站 你可能觉得,一 ...
- docker快速搭建
curl -sSL https://get.docker.com|sh docker --version systemctl start docker.service ps -ef|grep doc ...
- 条款20:宁以pass-by-reference-to-const替换pass-by-value(Prefer pass-by-reference-to-const to pass-by-value)
NOTE: 1.尽量以pass-by-reference-to-const 替换pass-by-value.前者通常比较高效,并可避免切割问题(slicing problem). 2.以上规则并不适用 ...