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. define 常量的定义和读取

    define(‘常量’,‘常量值’)----------------------define来定义常量, echo 也能输出常量, get_defined_constants(true)------- ...

  2. php_os 检查php运行环境

    if(strtolower(PHP_OS)=='linux'){ $tests['os']['state']="good"; $tests['os']['message']='OS ...

  3. C#如何提取.txt文件中的每个字符串

    C#如何提取.txt文件中的每个字符串,并将其存放到一个类中. 将其中的编号 菜名 价格 分别存入不同的数组中. 注:在用ReadLine读取一行信息时为什么读取的中文字符变成了乱码. 20 满意答案 ...

  4. java 百分比显示Double类型数值

    DecimalFormat percent = new DecimalFormat("0.00%"); completed_num = (double) involvedTask_ ...

  5. Windows 7 64bit Python 2 Install

    安装 setuptools 出现 UnicodeDecodeError 文件 Lib/mimetypes.py 中的 bug, 通过以下 patch 修复: Index: Lib/mimetypes. ...

  6. Jenkins自动化部署代码

    通过jenkins自动化部署项目代码可以大幅度节省打包上传部署的时间,提高开发测试的工作效率 ========== 完美的分割线 =========== 1.Jenkins是什么 1)Jenkins是 ...

  7. C程序第四次作业

    作业要求一 实践最简答的项目wordcount,必须完成其中的基本功能,若可以完成其他功能给予加分.完成后请将你的设计思路.主要代码写在本次作业博客里. 设计思路: 第一步:定义文件型指针变量fp,整 ...

  8. STM32中断定时,控制LED灯

    #include "led.h" void TIM3_Int_Init(u16 arr,u16 psc) { TIM_TimeBaseInitTypeDef TIM_TimeBas ...

  9. Java乱码解决之道

    1.常见字符编码 ASCII编码: ASCII,American Standard Code for Information Interchange,是基于拉丁字母的一套电脑编码系统,主要用于显示现代 ...

  10. hdu2090-2097

    hdu2090 模拟 #include<stdio.h> int main(){ ]; ,a1,a2; ; while(scanf("%s%lf%lf",b,& ...