1036 Boys vs Girls (25 分)
This time you are asked to tell the difference between the lowest grade of all the male students and the highest grade of all the female students.
Input Specification:
Each input file contains one test case. Each case contains a positive integer N, followed by N lines of student information. Each line contains a student's name, gender, ID and grade, separated by a space, where name and IDare strings of no more than 10 characters with no space, gender is either F (female) or M (male), and grade is an integer between 0 and 100. It is guaranteed that all the grades are distinct.
Output Specification:
For each test case, output in 3 lines. The first line gives the name and ID of the female student with the highest grade, and the second line gives that of the male student with the lowest grade. The third line gives the difference gradeF−gradeM. If one such kind of student is missing, output Absent in the corresponding line, and output NA in the third line instead.
Sample Input 1:
3
Joe M Math990112 89
Mike M CS991301 100
Mary F EE990830 95
Sample Output 1:
Mary EE990830
Joe Math990112
6
Sample Input 2:
1
Jean M AA980920 60
Sample Output 2:
Absent
Jean AA980920
NA
分析:水题,一次过。。
/**
* Copyright(c)
* All rights reserved.
* Author : Mered1th
* Date : 2019-02-23-23.25.59
* Description : A1036
*/
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<unordered_set>
#include<map>
#include<vector>
#include<set>
using namespace std;
;
struct student{
string name;
string id;
int score;
}temp,M,F;
int main(){
#ifdef ONLINE_JUDGE
#else
freopen("1.txt", "r", stdin);
#endif
M.score=;
F.score=-;
int n;
char gender;
scanf("%d",&n);
;i<n;i++){
cin>>temp.name>>gender>>temp.id>>temp.score;
if(gender=='M' && temp.score < M.score){
M=temp;
}
else if(gender=='F' &&temp.score > F.score){
F=temp;
}
}
) printf("Absent\n");
else cout<<F.name<<" "<<F.id<<endl;
) printf("Absent\n");
else cout<<M.name<<" "<<M.id<<endl;
|| M.score==) printf("NA\n");
else printf("%d\n",F.score-M.score);
;
}
1036 Boys vs Girls (25 分)的更多相关文章
- 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甲级:1036 Boys vs Girls (25分)
PAT甲级:1036 Boys vs Girls (25分) 题干 This time you are asked to tell the difference between the lowest ...
- PAT 1036 Boys vs Girls (25分) 比大小而已
题目 This time you are asked to tell the difference between the lowest grade of all the male students ...
- 【PAT甲级】1036 Boys vs Girls (25 分)
题意: 输入一个正整数N(题干没指出范围,默认1e5可以AC),接下来输入N行数据,每行包括一名学生的姓名,性别,学号和分数.输出三行,分别为最高分女性学生的姓名和学号,最低分男性学生的姓名和学号,前 ...
- 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 (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 ...
- PATA 1036. Boys vs Girls (25)
https://www.patest.cn/contests/pat-a-practise/1036 #include <bits/stdc++.h> using namespace st ...
- 1036. Boys vs Girls (25)
#include <stdio.h>#include <string.h>int main(){ int n,i; while(scanf("%d",&am ...
随机推荐
- MyEclipse移动开发教程:设置所需配置的iOS应用(二)
MyEclipse个人授权 折扣低至冰点!立即开抢>> [MyEclipse最新版下载] 二.创建一个数字证书和私钥 2.2 生成证书签名请求和私钥文件 第一步是使用数字签名实用程序创建证 ...
- WLAN 802.11 a/b/g PHY Specification and EDVT Measurement V
Receive Minimum Input Level (Sensitivity) 测试方法: Receiver Adjacent Channel Rejection (ACR) -For IEEE8 ...
- Python seek和tell
f = open("胡辣汤", mode="r+", encoding="utf-8") f.seek(0,2) # 移动到末尾 conte ...
- Vue.js更改调试地址端口号
Vue项目一般使用自带的脚手架工具vue-cli和webpack打包方式进行项目构建运行.开发中,我们在控制台输入命令行npm run dev部署项目后,默认开启的页面调试地址是8080端口.但是有时 ...
- [C#] 网站程序ASP.NET的性能诊断 - CPU分析
微软提供了标准的CLR性能分析类库 https://github.com/Microsoft/clrmd 这个类库是开源的代码.能够获取CLR runtime里面几乎所有的信息. 如何获取clrmd编 ...
- ldconfig
#ldconfig# http://www.cnblogs.com/lyongde/p/4190588.html ldconfig是一个动态链接库管理命令,为了让动态链接库为系统所共享,还需运行动态链 ...
- opencv-python教程学习系列1-安装库
前言 以后的项目可能会用到python和opencv进行实现,故准备opencv-python教程学习系列记录学习过程的点滴,这是这一系列的开篇,坚持学习,共同进步. 系列教程参照OpenCV-Pyt ...
- liunx用户管理的基本命令
1.passwd 修改用户密码 2.useradd 用户组名 增加用户组 3.su 用户名 切换用户名 4.usermod 用户更改 5.userdel 用户删除
- centos7安装mysql5.7的终极解决方案
在centos7中安装最新版本mysql5.7.10可能会出现各种各样的问题,不管出现什么问题,先仔细阅读下面,或许对你有帮助! 1.systemctl stop mysqld.service 关闭m ...
- M端计算rem方法
(function(){var a=document.documentElement.clientWidth||document.body.clientWidth;if(a>460){a=460 ...