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> ...
随机推荐
- WinForm导出文件
1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 ...
- crossplatform---Nodejs in Visual Studio Code 01.简单介绍Nodejs
1.开始 作者自己:开发人员,Asp.Net , html / js , restful , memcached , oracle ,windows , iis 目标读者:供自己以后回顾 2.我看No ...
- matlab 各种文件的读取(及读写问题的解决)
0. 文本文件 load('**.mat') load('**.mat', '-ascii') load('-mat', filename) load('-ascii', filename) 1. 音 ...
- CCPlace,CCFlip*,CCToggleVisibility,CCMoveTo*,CCJumpTo*,CCScale*,CCRotate*,CCSkew*,fade,CCCardinalSp*
1 CCAction动作 CCAction作为一个基类.事实上质是一个接口(即抽象类),由它派生的实现类(如运动和转动等)才是我们实际使用的动作.CCAction 的绝大多数实现类都派生自CCF ...
- wpf C# 操作DirectUI窗口 SendMessage+MSAA
原文:wpf C# 操作DirectUI窗口 SendMessage+MSAA 最近做一个抓取qq用户资料的工具,需要获取qq窗口上的消息,以前这种任务是用句柄获取窗口中的信息,现在qq的窗口用的是D ...
- vagrant up default: Warning: Authentication failure. Retrying...的一些解决办法
vagrant up default: Warning: Authentication failure. Retrying...的一些解决办法 一般看到这个信息时,虚拟机已经启动成功,可以中断命令后v ...
- WPF 控件的内容属性
WPF的内容属性不应定都是content, 例如TextBlock的内容属性是Text Panel的内容属性是Children ListBox的内容属性是Items
- 深入解析Android关机
下图详细阐释了Android的关机顺序. 第一步: 按住电源按钮半秒钟(500ms). 第二步: 之后,PhoneWindowManager.java 将捕获长按电源按钮这一事件并调用“interce ...
- Android Xposed框架出现java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation问题
第一次玩Xposed框架,按照多个demo的格式写了一个demo发现死活不进入 public abstract void handleLoadPackage(LoadPackageParam lppa ...
- HTTP请求(GET与POST区别)和响应(get是从服务器上获取数据,post是向服务器传送数据,格式与举例都非常清楚)
HTTP有两部分组成:请求与响应,下面分别整理. 一.HTTP请求 1.HTTP请求格式: <request line> <headers> <blank line> ...