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 将Bitmapsource转换到Emgu.cv.image
原文:WPF 将Bitmapsource转换到Emgu.cv.image Transform WPF BitmapSource to Emgu.CV.Image******* /// <summ ...
- AntDesign Form表单字段校验的三种方式
1.使用getFieldDecorator的rules规则 最简单的方法就是使用getFieldDecorator中的rules验证.rules中定义校验规则,message为校验不通过时的提示文字. ...
- WPF依赖项属性不需要包装属性也可以工作
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threa ...
- C++ Boost 学习资源列表
文档书籍下载 Boost Documentation Boost代码下载 优秀网站导航 Boost官方网站 Boost中文站 Boost Consulting 专题资源报告 Lin ...
- Gradle离线配置
原文:Gradle离线配置 1. 先在Gradle官网下载最新的离线zip压缩包. https://gradle.org/ 2. 将下载的zip压缩包,保存到本地磁盘下的目录中. 3. 修改(grad ...
- 原生Js监听普通dom尺寸变化
原生Js监听普通dom尺寸变化 具体做法有以下几种: 初始化项目后,轮询,反复查看 dom 尺寸是否变化,这种一听就感觉不好,开销太大. 监听元素的滚动事件,在 目标 dom 里面包裹一个同等大小的 ...
- 前端PS常用切图技巧
前言:前端涉及到的 ps 操作不算复杂,基本上就是切图,本文总结了常用的几种切图技巧. 工具:photoshop cs6 . photoshop cc 1. 传统切图 01 这是最笨的一种方法,核心就 ...
- Android Xposed框架出现java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation问题
第一次玩Xposed框架,按照多个demo的格式写了一个demo发现死活不进入 public abstract void handleLoadPackage(LoadPackageParam lppa ...
- Win8 Metro(C#)数字图像处理--2.46图像RGB分量增强效果
原文:Win8 Metro(C#)数字图像处理--2.46图像RGB分量增强效果 [函数名称] RGB分量调整 RGBAdjustProcess(WriteableBitmap ...
- mysql 服务压缩包安装,用户创建
wind7上安装mysql记录: 1.下载的包中没有ini配置文件,需要根目录手动创建my.ini文件 内容如下: [client]port=3306default-character-set=utf ...