PATA 1036. Boys vs Girls (25)
https://www.patest.cn/contests/pat-a-practise/1036
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,i,gra,boyc = ,girlc = ,boymin = ,girlmax = -;//n,输入成绩,男生计数,女生计数,男最低分,女最高分
char nam[],gend,id[]; //输入信息
char name_m[],id_m[],name_f[],id_f[];//保存最低分男的个人信息,最高分女的个人信息
scanf("%d",&n);
for(i = ;i < n; i++)
{
scanf("%s %c %s %d",nam,&gend,id,&gra);
if(gend == 'M') {
boyc++;
if(gra < boymin){
boymin = gra;
strcpy(name_m,nam);
strcpy(id_m,id);
} }
else {
girlc++;
if(gra > girlmax){
girlmax = gra;
strcpy(name_f,nam);
strcpy(id_f,id);
}
}
}
if(girlc == ){
printf("Absent\n");
}
else{
printf("%s %s\n",name_f,id_f);
}
if(boyc == ){
printf("Absent\n");
}
else{
printf("%s %s\n",name_m,id_m);
}
if(girlc == ||boyc == ){
printf("NA");
}
else{
printf("%d",girlmax-boymin);
}
return ;
}
PATA 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 ...
- 1036. Boys vs Girls (25)
#include <stdio.h>#include <string.h>int main(){ int n,i; while(scanf("%d",&am ...
- PAT甲题题解-1036. Boys vs Girls (25)-找最大最小,大水题
题意:给出n个人的姓名.性别.ID.分数,让你找出其中哪个妹纸分数最高.哪个汉子分数最低.以及他们的差如果没有妹纸或者汉子,则对应输出Absent,差用NA代替. 就是for一遍找最大最小值,水题 # ...
- 1036 Boys vs Girls (25)(25 point(s))
problem This time you are asked to tell the difference between the lowest grade of all the male stud ...
- PAT (Advanced Level) 1036. Boys vs Girls (25)
简单题. #include<iostream> #include<cstring> #include<cmath> #include<algorithm> ...
随机推荐
- 使用WPF将图片转变为灰度并加上水印并保存为文件
原文:使用WPF将图片转变为灰度并加上水印并保存为文件 运行效果: (上图中左下角为原图的缩小显示,By:Johnson为TextBlock)保存的结果图片:上图的"Test Words.& ...
- ASP.NET Core 动作结果 - ASP.NET Core 基础教程 - 简单教程,简单编程
原文:ASP.NET Core 动作结果 - ASP.NET Core 基础教程 - 简单教程,简单编程 ASP.NET Core 动作结果 前面的章节中,我们一直使用简单的 C# 类作为控制器. 虽 ...
- C++ 异常机制分析(C++标准库定义了12种异常,很多大公司的C++编码规范也是明确禁止使用异常的,如google、Qt)
阅读目录 C++异常机制概述 throw 关键字 异常对象 catch 关键字 栈展开.RAII 异常机制与构造函数 异常机制与析构函数 noexcept修饰符与noexcept操作符 异常处理的性能 ...
- QT pro 添加带空格的路径以及添加库文件的正确方法
用这个:$$quote() 如何添加库?看下面添加mysql路径的例子: INCLUDEPATH += $$quote(C:\Program Files (x86)\MySQL\MySQL Serve ...
- C# .NET锁屏程序(顺带屏蔽任务管理器)
原文:C# .NET锁屏程序(顺带屏蔽任务管理器) 第一步:将窗体的FormBorderStyle设置为none,WindowState设为Maximized 占据整个屏幕. 第二步:使用钩子监控全局 ...
- 【全面解禁!真正的Expression Blend实战开发技巧】第四章 从最常用ButtonStyle开始 - PathButton
原文:[全面解禁!真正的Expression Blend实战开发技巧]第四章 从最常用ButtonStyle开始 - PathButton 上一篇我们介绍了TextButton,但为了追求界面的张力, ...
- 使用BGP的虚拟下一跳实现IGP的路由负载
网络拓扑: XRV1 ============================================================== !hostname XRV1! interface ...
- WPF 在一个dll创建一个Window(包含xaml),在另一个dll中再次继承 会出错
https://social.msdn.microsoft.com/Forums/vstudio/en-US/e92390eb-bbfa-42fb-baa9-2286444c0dca/the-comp ...
- List.Sort() 小小技巧--- 从大到小排列
List.sort() 默认的情况下是从小到大的排列. 例如: List<int> list = new List<int>(); list.Add(- ...
- Linux简单文本处理
tr命令:tr [option] set1 [set2] 删除或者替换set1中的字符在文本表示这个问题中,windows系统下,\r\n为换行:而linux系统下,\n为换行.win->lin ...