1036. Boys vs Girls (25)
#include <stdio.h>
#include <string.h>
int main()
{
int n,i;
while(scanf("%d",&n)!=EOF)
{
char ManID[11]="",FelID[11]="",ManName[11],FelName[11];
char TemID[11],TemName[11],Gender;
int TemGrade,MaxGrade=-1,MinGrade=101;
for(i=0;i<n;i++)
{
getchar();
scanf("%s %c %s %d",TemName,&Gender,TemID,&TemGrade);
if(Gender=='M')
{
if(MinGrade > TemGrade)
{
strcpy(ManName,TemName);
strcpy(ManID,TemID);
MinGrade = TemGrade;
}
}
else
{
if(MaxGrade < TemGrade)
{
strcpy(FelName,TemName);
strcpy(FelID,TemID);
MaxGrade = TemGrade;
}
}
}
int complete=1;
if(strcmp(FelID,"")==0)
{
printf("Absent\n");
complete=0;
}
else printf("%s %s\n",FelName,FelID);
if(strcmp(ManID,"")==0)
{
printf("Absent\n");
complete=0;
}
else printf("%s %s\n",ManName,ManID);
if(complete) printf("%d\n",MaxGrade-MinGrade);
else printf("NA\n");
}
return 0;
}
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 ...
- PATA 1036. Boys vs Girls (25)
https://www.patest.cn/contests/pat-a-practise/1036 #include <bits/stdc++.h> using namespace st ...
- PAT 1036 Boys vs Girls (25分) 比大小而已
题目 This time you are asked to tell the difference between the lowest grade of all the male students ...
- 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> ...
随机推荐
- Python学习笔记 第一课 列表
Python的列表就像是一个数组: 一.创建列表 movies=["The Holy Grail","Then Life of Brian","The ...
- 利用OPENSSL 实现MD5加密。
#include <stdio.h> #include "openssl/evp.h" #include "openssl/md5.h" #incl ...
- python(6)-类
面向对象编程是一种编程方式,此编程方式的落地需要使用 "类" 和 "对象" 来实现,所以,面向对象编程其实就是对 "类" 和 "对 ...
- 【置换,推理】UVa 1315 - Creaz tea party
Dsecription n participants of «crazy tea party» sit around the table. Each minute one pair of neighb ...
- Java HashCode方法
有许多人学了很长时间的Java,但一直不明白hashCode方法的作用, 我来解释一下吧.首先,想要明白hashCode的作用,你必须要先知道Java中的集合. 总的来说,Java中的集合(Co ...
- Linux 命令 - ss: 查看套接字统计信息
命令格式 ss [options] [ FILTER ] 命令参数 -h, --help 显示帮助信息. -V, --version 显示版本信息. -n, --numeric 不解析服务名称. -r ...
- NGUI的原理机制:深入剖析UIPanel,UIWidget,UIDrawCall底层原理
这是我去搜狐畅游面试时,面试官问的一个问题.问NGUI的机制原理是什么?就是这个插件是根据什么写出来的.当时没答上来,下面是我从转载过来的,可以研究研究. 之前项目中用的NGUI的版本是3.0.7 f ...
- Commons-logging + Log4j
一.Commons-logging能帮我们做什么? 1.提供一个统一的日志接口,简单了操作,同时避免项目与某个日志实现系统紧密耦合 2.自动选择适当的日志实现系统 a.classpath下查找comm ...
- Cocos2d-x数据持久化-查询数据
数据查询一般会带有查询条件,这可以使用SQL语句的where子句实现,但是在程序中需要动态绑定参数给where子句.查询数据的具体操作步骤如下所示.(1) 使用sqlite3_open函数打开数据库. ...
- PHP学习笔记 - 进阶篇(10)
PHP学习笔记 - 进阶篇(10) 异常处理 抛出一个异常 从PHP5开始,PHP支持异常处理,异常处理是面向对象一个重要特性,PHP代码中的异常通过throw抛出,异常抛出之后,后面的代码将不会再被 ...