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 namegenderID 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 grade​F​​−grade​M​​. 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 分)的更多相关文章

  1. PAT 甲级 1036 Boys vs Girls (25 分)(简单题)

    1036 Boys vs Girls (25 分)   This time you are asked to tell the difference between the lowest grade ...

  2. PAT 1036 Boys vs Girls (25 分)

    1036 Boys vs Girls (25 分)   This time you are asked to tell the difference between the lowest grade ...

  3. 1036 Boys vs Girls (25分)(水)

    1036 Boys vs Girls (25分)   This time you are asked to tell the difference between the lowest grade o ...

  4. PAT甲级:1036 Boys vs Girls (25分)

    PAT甲级:1036 Boys vs Girls (25分) 题干 This time you are asked to tell the difference between the lowest ...

  5. PAT 1036 Boys vs Girls (25分) 比大小而已

    题目 This time you are asked to tell the difference between the lowest grade of all the male students ...

  6. 【PAT甲级】1036 Boys vs Girls (25 分)

    题意: 输入一个正整数N(题干没指出范围,默认1e5可以AC),接下来输入N行数据,每行包括一名学生的姓名,性别,学号和分数.输出三行,分别为最高分女性学生的姓名和学号,最低分男性学生的姓名和学号,前 ...

  7. 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 ...

  8. 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 ...

  9. PATA 1036. Boys vs Girls (25)

    https://www.patest.cn/contests/pat-a-practise/1036 #include <bits/stdc++.h> using namespace st ...

  10. 1036. Boys vs Girls (25)

    #include <stdio.h>#include <string.h>int main(){ int n,i; while(scanf("%d",&am ...

随机推荐

  1. spring的orm模块

    spring整合hibernate 1.hibernate使用注解. daoImpl需要继承HibernateDaoSupport对象,针对给对象的getHibernateTemplate()进行hi ...

  2. iPad mini Retina越狱小结【2014年02月06日 - 初稿】

    Update History 2014年02月06日 - 初稿 0.引言 本来一直都没有苹果的产品除了第一代的iPod(没怎么使用最后大学送人了 @李清纯(255270520) ,巧合的是老妈学校发了 ...

  3. windows下清除svn密码

    刚进公司的时候没有SVN账号,暂用别人的账号很平常,为了更好的代码管理,后面肯定用自己的账号. 那么怎么清除呢. 进入 C:\Documents and Settings\Administrator\ ...

  4. ESXi6.5中将虚拟机从厚置备转换为精简置备

    本文来自:https://blog.csdn.net/wangjingkaibear/article/details/77097041 用ESXi做虚拟化,创建了一个原始虚拟机并安装好系统做好基本设置 ...

  5. 20165210 Java第七周学习总结

    20165210 Java第七周学习总结 教材内容学习 第十一章学习总结 连接数据库: 1. 下载JDBC-MySQL数据库驱动 2. 加载JDBC-MySQL数据库驱动 3. 连接数据库 4. 注意 ...

  6. ubuntu16.04-caffe安装过程详解-草稿

    前言 目前主要模块都是基于深度学习展开的,虽然知道一些深度学习的基础知识,只是皮毛,还没有使用深度学习框架练手甚至深入,故开始着手深度学习的实操和深入学习. 操作步骤 参考 1.Ubuntu16.04 ...

  7. socket can demo

    http://www.cnblogs.com/zengjfgit/p/5327689.html

  8. iPhone/iPad被停用怎么办 3招轻松解锁

    家中小孩玩电脑游戏,自己拿了iPad,随便输入密码,结果造成平板电脑无法使用,相信这是许多家长都将面对或是早已发生的事情.本文整理当iPhone或是iPad被停用时的处理方法. iPhone被停用 为 ...

  9. spring boot sso 学习资源

    diy: 关键字: springboot sso:public boolean preHandle(HttpServletRequest request, HttpServletResponse re ...

  10. 使用js 文件参数 以及IHttpModule实现服务验证asp.net 版的初步实现

    接上面的文章,上面的主要是进行html 页面自己进行处理.但是对于进行asp.net 的开发者以及其他的就显的不太好了. 我的实现方式是使用IHttpModule 进行对于用户请求的带有参数的js文件 ...