1036. Boys vs Girls (25)
以分数为核心的事件模拟
#include<iostream>
#include<vector>typedef struct Student
{char name[20];char gender;char id[20];int g;
}Student;bool ValidGrade(int g)
{if(g >= 0 && g <= 100)return true;else return false;
}
int main()
{int n;while(scanf("%d",&n)!=EOF){Student fmale, male;fmale.g=-1;//get highestmale.g=101;//get lowest//inputStudent tmp;while(n--){scanf("%s %c %s %d", tmp.name, &tmp.gender, tmp.id, &tmp.g);if(tmp.gender == 'F' && tmp.g > fmale.g)fmale = tmp;else if(tmp.gender == 'M' && tmp.g < male.g)male = tmp;}//outputif( ValidGrade(fmale.g) )printf("%s %s\n",fmale.name, fmale.id);else printf("Absent\n");if( ValidGrade(male.g) )printf("%s %s\n",male.name, male.id);else printf("Absent\n");if( ValidGrade(fmale.g) && ValidGrade(male.g) )printf("%d\n", fmale.g-male.g);else printf("NA\n");}return 0;
}
1036. Boys vs Girls (25)相关推荐
- 【PAT甲级 排序】1036 Boys vs Girls (25 分) C++
题目 是个水题,排序就完事. 输出女生最高分的学生,男生最低分的学生,并计算分差. 一点点小坑:让输出啥,看清楚再写,不要靠记忆做题 一开始把题目中要求输出的NA看成了NAN,一开始有两个测试用例过不 ...
- 1036 Boys vs Girls (25 分)_27行代码AC
立志用最少的代码做最高效的表达 PAT甲级最优题解-->传送门 This time you are asked to tell the difference between the lowest ...
- 1036 Boys vs Girls (25 分)
题目链接 #include <iostream> using namespace std; int main() {int n;scanf("%d", &n); ...
- 1036. Boys vs Girls
1036. Boys vs Girls (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue This ti ...
- PAT甲级1036 Boys vs Girls:[C++题解] 字符串处理
文章目录 题目分析 题目链接 题目分析 分析可以看下方代码注释. ac代码 #include<bits/stdc++.h> using namespace std;int n; const ...
- A1036 Boys vs Girls 25分
A1036 Boys vs Girls 25分 题目描述: 题目大意: 输入一个数N,以下N行每行输入一个学生信息,找到女生成绩最高的人和男生成绩最低的人,最后输出他们的名字.学号和成绩的差值. 思路 ...
- PAT1036:Boys vs Girls
1036. Boys vs Girls (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue This ti ...
- delphi word类型_现在的女生喜欢什么类型的男生?|What Kind of Boys Do Girls Like?
nán shēng dōu xiǎng chéng wéi nǚ shēng de lǐ xiǎng xíng 男生都想成为女生的理想型, dōu xiǎng huò dé nǚ shēng de x ...
- Python-1036 Boys vs Girls
代码如下 N = int(input()) peo = [0 for _ in range(N+2)] for i in range(N):peo[i] = input().split(' ') ls ...
最新文章
- 批量更新日期字段中的年
- JAVAWEB项目--模拟考试系统需求(一)
- Item03. 设计模式 Item04. STL
- 感恩节祝福html,感恩节祝福英文
- win10切换输入法快捷键_输入法失灵怎么办?该怎么恢复?
- 腾讯回应“暴力裁员”;小米否认常程与联想签有竞业禁止条款;NumPy 1.16.6 发布 | 极客头条...
- js系列教程7-DOM操作全解
- clickhouse条件函数
- SQL Server用户权限详解
- C++静态代码分析工具横向对比
- node.js+uniapp计算机毕业设计安卓在线民宿预定app(程序+APP+LW)
- 约翰 霍普克罗夫特计算机科学中心,上海交通大学约翰·霍普克罗夫特计算机科学中心(John Hopcroft Center)...
- 【NVMe】NVMe 1.3协议中文翻译——第一章简介
- photon 服务器操作系统,[专栏作家] Photon Server之Photon Control服务器控制界面
- 【Codecs系列】颜色空间转换CSconvert:NV21转BGR24和BGR24转NV21
- Unity事件分发器
- 嵌入式Linux引导过程之1.4——Xloader的ddr_init
- 僵尸毁灭工程服务器耐久修改,僵尸毁灭工程无限负重的修改方法
- MSP430控制AD7712采集数据
- 【已解决】Chrome上js不生效