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. DevExpress v18.1新版亮点——ASP.NET篇(一)

    用户界面套包DevExpress v18.1日前终于正式发布,本站将以连载的形式为大家介绍各版本新增内容.本文将介绍了DevExpress ASP.NET v18.1 的新功能,快来下载试用新版本!点 ...

  2. 《JAVA---day03---运算符》

    /*[位运算符] 运算符: 运算 范例 说明 <<: 左移 3<<2=12--->3*2*2=12 >>: 右移 3>>2=1---->3/ ...

  3. Python 字符串的相关操作

    s = "abcdefg" s1 = s.capitalize() # 把首字母变成大写, 返回给你一个新的字符串 print(s) print(s1) s = "ale ...

  4. 阿里云Linux CentOS 7 Docker部署使用gogs搭建自己的git服务器

    一.前言 Git是目前优秀和流行的源代码管理工具.而GitHub是一个面向开源及私有软件项目的托管云平台,但开源免费,私有收费.而公司出于商业化等目的需要搭建自己的源代码托管服务器.通过网上了解Gog ...

  5. Swift中正则使用正则的几种方式

    之前记录了用正则验证邮箱地址   下面我也记录一下用其它方法使用正则 如下,查询字符串内是否有大写字母,注意rangeOfString方法的第二个参数是.RegularExpressionSearch ...

  6. OK335xS UART device registe hacking

    /************************************************************************* * OK335xS UART device reg ...

  7. [LeetCode&Python] Problem 566. Reshape the Matrix

    In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new o ...

  8. CodeForces - 457C:Elections(三分)

    You are running for a governor in a small city in Russia. You ran some polls and did some research, ...

  9. Linux操作系统网络配置

  10. Weston学习

    来源网址:http://blog.csdn.net/fyh2003/article/details/49253713 Weston启动时会读取weston.ini这个配置文件,其中可以配置桌面,动画和 ...