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 ...
随机推荐
- QQ提示应用程序并行配置不正确,绿色版QQ不能运行解决方法
出现此问题是因为您的计算机中缺少VC运行库导致的,建议您到互联网上下载相应的VC2005运行库,Windows 7请下载VC2008运行库安装到您的计算机中.如果您安装了运行库还是不行,建议您安装:( ...
- STL标准库-一个万用的hash function
技术在于交流.沟通,本文为博主原创文章转载请注明出处并保持作品的完整性 在前面我介绍过hash的使用,本次主要介绍一下Hash Function Hash Function即获得hash code的函 ...
- JavaScript console控制台调试 post
fetch("api_v1/XinSheng_QQPay_QRCode", { body: "charset=1&msgExt=%u4ea4%u6613%u621 ...
- 微信小程序之蓝牙开发(详细读数据、写数据、附源码)
本文将详细介绍微信小程序的蓝牙开发流程(附源码)准备:微信只支持低功耗蓝牙也就是蓝牙4.0,普通的蓝牙模块是用不了的,一定要注意. 蓝牙可以连TTL接到电脑上,再用XCOM调试 一开始定义的变量 va ...
- CF1092(div3):Great Vova Wall (栈)(还不错)
D1. Great Vova Wall (Version 1): 题意:给定长度为N的墙,以及每个位置的一些高度,现在让你用1*2的砖和2*1的砖去铺,问最后能否铺到高度一样. 思路:分析其奇偶性,在 ...
- 20155316 2016-2017-2 《Java程序设计》第5周学习总结
教材学习内容总结 这周总结 try catch语法 异常继承结构 throw finally AutoCloseable接口 Collection Map Lambda表达式 上周总结 三个关键 类与 ...
- http状态码301和302详解及区别——辛酸的探索之路(文章源自:http://blog.csdn.net/grandPang/article/details/47448395)
一直对http状态码301和302的理解比较模糊,在遇到实际的问题和翻阅各种资料了解后,算是有了一定的理解.这里记录下,希望能有新的认识.大家也共勉. 官方的比较简洁的说明: 301 redirect ...
- CTF-练习平台-Misc之 猜?
六.猜? 打开图片后发现是一个半个脸被遮住的美女,再联系到题目是“猜”,答案又是一个人的名字全拼,所以熟悉的人都知道这是刘亦菲,把拼音输进去就可以啦.
- 初识Tarjan算法
#include<bits/stdc++.h> using namespace std; ; ;//强连通分量的个数 int stk[maxn];//暂时存放遍历过的点,在遇到low[x] ...
- 数据库表结构转成设计书,PowerDesigner 表格导出为excel
数据库中的表导入到PowerDesigner中并转为excel文档 1.打开PowerDesigner12,在菜单中按照如下方式进行操作 file->Reverse Engineer->D ...